Resolving conflicts in the Git plugin?

Post here questions and problems related to editing and publishing DITA content.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Resolving conflicts in the Git plugin?

Post by chrispitude »

Hi all,

I'm testing the Git plugin (THANK YOU for making this!!) and I'm trying to figure out how server/local conflicts are resolved.

Starting out, the server and my local repo both have the following:

Code: Select all

        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
            ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
            ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
On the server, I successfully commit the following change:

Code: Select all

        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
            ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
            ullamco laboris nisi ut aliquip ***ADDED ON SERVER*** ex ea commodo consequat.</p>
In my local repo, I successfully commit the following change (note that the paragraph rewraps from the change):

Code: Select all

        <p>Lorem ipsum ***ADDED LOCALLY*** dolor sit amet, consectetur adipiscing elit, sed do
            eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
            quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
When I do a push, I am told that I can't because my current branch is behind. This is expected.

When I do a pull to update my current branch, I get the following error:
Cannot pull. Your local changes to the following files would be overwritten by merge:
<test filename here>
At this point I become stuck. The "Resolve Conflict" item in the Git Staging context menu is ghosted out and unselectable. If I choose "Open in compare editor", it shows me the old (pre-pull) server content on the right side and I'm unable to make any changes that resolve the conflict.

I've made other simple changes without rewrapped paragraphs and they were successful, but this situation seems to put Oxygen and the Git plugin into an unresolveable state.

My expectation would be that the "Resolve Conflict" context menu item is selectable and allows me to resolve the differences versus the current server branch.

What's the proper workflow in this case?
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Resolving conflicts in the Git plugin?

Post by sorin_carbunaru »

Hello,

Unfortunately I cannot replicate the same behavior. I got a conflict, and the "Resolve conflict" submenu is enabled. This is what I did:
1. I had the following DITA topic:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="carnati">
    <title>Lorem ipsum</title>
    <body>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
            ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
            ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </body>
</topic>
2. Made the change you mentioned on the server (GitHub).
3. Made the change in the local file, and invoked "Format and Indent" to re-wrap the lines, then committed it. At this point I have one incoming change and one outgoing.
4. I try to pull, but I get a conflict.

I tested this using the add-on's source code, which is identical to the public version 1.5.1.

Did you do something different? Perhaps you can send us the test file to support@oxygenxml.com or invite me (sorincarbunaru) as a contributor to a test repository on GitHub, if needed. My guess is that you are doing something different and that's why we don't get the same result.

By the way, the message you mentioned (Cannot pull. Your local changes to the following files would be overwritten by merge) should only be shown if you still have some local changes that are not committed... Did you accidentally make another change in the document before pulling? Or perhaps there was a change coming from the server in another document that was locally modified but uncommitted...

Sorin Carbunaru
oXygen XML
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Resolving conflicts in the Git plugin?

Post by chrispitude »

Hi Sorin,

It was user error. :( I thought maybe I could pull the server revisions into my local copy before committing it. The tool message is clear; it was my thinking that prevented me from understanding it.

A couple more questions about conflict resolution in a Git flow:

1. What is the difference between "copying" and "appending" a change? I see buttons for both (<- and <<) in the conflict resolution window, but I haven't figured out the difference, and I didn't find any documentation explaining them (but I'm probably not finding that either!).

2. Is there any meaning to modifying the right side in the 3-way diff? The only meaningful actions are modifying the left side, right?
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Resolving conflicts in the Git plugin?

Post by alex_jitianu »

Hi Chris,

1. According to the User's Manual (https://www.oxygenxml.com/doc/versions/ ... rison.html):
Append left change to right and Append right change to left
Copies the content of the selected change from one side and appends it on the other, according to the content of the corresponding change. As a result, the side where the arrow points to will contain the changes from both sides.
Copy change from left to right and Copy change from right to left
Replaces the content of a change from one side with the content of the corresponding change from the other side.
So, let's say we have the text "L_Test" in the left editor and "R_Test" in the right one. Copying from left to right leads to having "L_Test" in both editor. Appending from left to right leads to "RL_Test" in the right editor.

2. In the "Editor" preferences page, there is a "Can edit read-only files" option that is enabled by default. That's why copying from left to right is allowed. If you deactivate the option, you will see exactly what you would expect: disabled action, the inability to copy, etc.

Sorin C.
Post Reply