It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bug: Aborting conflict resolution still stages file when using external tool

1. Right click on an unstaged file > Resolve Conflicts > Launch External Merge Tool

2. Externa tool is opened, SourceTree shows "Visual Merge In Progress" window with Abort button

3. After I click Abort and close external, SourceTree moves the unstaged file to staged files and in unstaged file new ".orig" file is left

 

My expectation is that since I aborted the the conflick resolution, it should leave the file in unstaged section. Right now I have to manually mark the file as unresolved. Also, if there are multiple files in Staged files, it is sometimes hard to find the file.

 

I tried reporting this as a bug but your bug tracking website does not allow me to do that - the Create issue window has only Cancel button...

1 answer

0 votes
Mike Corsaro Atlassian Team Feb 13, 2019

Hello! This is a result of the return code your merge-tool is returning back to Git. You can read more about this here

What does the "Abort" button do if it's not aborting the conflict resolution?

Mike Corsaro Atlassian Team Feb 14, 2019

It just closes the dialog and terminates the process. I assume git then updates the index when your tool closes.

 

You can see the same behavior Sourcetree does by doing the following via the terminal:

  • Have a conflicting file in your repo
  • Run:
    • git mergetool -y --tool=YOUR_MERGE_TOOL -- YOUR_FILE_NAME
  • Wait for the mergetool to start
  • Kill the git.exe process via task manager
  • Close the merge tool and observe that "git status" no longer reports a merge conflict

It just closes the dialog and terminates the process. I assume git then updates the index when your tool closes.

It does not terminate the process. Tested with p4merge and with WinMerge. I have to close the tool myself. To me it looks like the button does nothing.

 

 

  • git mergetool -y --tool=YOUR_MERGE_TOOL -- YOUR_FILE_NAME

Yes you are right, git behaves in the same way. In the config I see following:

mergetool.sourcetree.cmd='C:/Program Files/Perforce/p4merge.exe' "$BASE" "$LOCAL" "$REMOTE" "$MERGED"

After running:

git mergetool -y --tool=sourcetree -- myfile

and closing p4merge window and choosing not to save changes, the file is indeed moved to staged.

 

 

So I understand that SourceTree is simply calling git to do the merge resolution using mergetool, and I'd have the same issue if I was using git directly.

Still, is there no way to abort a conflict resolution using external tool, in a way that the file is not staged and that it's still marked as having unresolved conflict?

I am having the same issue. Is there a way to tell git to leave the file unresolved? When the external merge tool aborted or otherwise did not complete the merge.

Maybe there's something similar to setting git config mergetool.<tool>.trustExitCode to 0/false in Sourcetree?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,907 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you