GIT merge file contents are incorrect for the file name. (SmartGit/Hg || IntelliJ IDEA) && (P4Merge || KDiff3)

934 views Asked by At

THE PROBLEM

In setting up the merge tool to resolve conflicts, the files sent to the merge tool are not correct for the content they contain. I have tried searching Stack Overflow, but have not found an answer.


Details

I'm new to GIT. In trying to learn more, I've set up a private repo on Bitbucket. I have Windows 7 64-bit and the following software:

  • GIT Client: SmartGit/Hg
  • Code Editor: IntelliJ IDEA Ultimate
  • Merge: P4Merge || KDiff3

When KDiff3 is called from SmartGit/Hg:

(A) C:\Users\Username\AppData\Local\Temp\smartgit6393324384790956404tmp\compare_base_2787531226782357806_README.md
(B) C:\Users\Username\AppData\Local\Temp\smartgit6393324384790956404tmp\compare_ours_2686269382530657828_README.md
(C) C:\Users\Username\AppData\Local\Temp\smartgit6393324384790956404tmp\compare_theirs_8849401324186420794_README.md
(OUTPUT) D:\Path\to\project\README.md

When KDiff3 is called from IDEA:

(A) C:\Users\Username\AppData\Local\Temp\Merge_Result2324777776464644375.md
(B) C:\Users\Username\AppData\Local\Temp\Local_Changes7034162268721107201.markdown
(C) C:\Users\Username\AppData\Local\Temp\Changes_from_Server__revision_d7bcd6bd85df4f7bae648786dfa944825991b4f3_1371061438544389037.markdown
(OUTPUT) D:\Path\to\project\README.md

  • (A) correctly displays the base, in the case of IDEA "Merge_Result" is confusing, but at least it has the base data.
  • The contents of (B) is HEAD data where it should be LOCAL.
  • The contents of (C) is displaying LOCAL data where it should be HEAD.
  • (OUTPUT) is the correct location of conflicted file that the merge/resolution should be saved to.

My understanding is that local data is in mine/ours/yours/local files and the head data should be in theirs/remote/head files.


Settings

SmartGit/Hg P4Merge settings:

File Pattern: *.md
Command: P:\Program Files\Perforce\p4merge.exe
Arguments: ${baseFile} ${leftFile} ${rightFile} ${mergedFile}

SmartGit/Hg KDiff3 settings:

File Pattern: *.md
Command: P:\Program Files (x86)\KDiff3\kdiff3.exe
Arguments: ${baseFile} ${leftFile} ${rightFile} -o ${mergedFile}

I'll update the file pattern once I resolve the problem.

IDEA KDiff3 settings:

Path to executable: P:\Program Files (x86)\KDiff3\kdiff3.exe
Parameters: %2 %1 %3 -o %4


The question

Both P4Merge and KDiff3 have the same problems, which makes me think something may be wrong with my local GIT install, but I have no idea where to look next to troubleshoot and resolve this. What have I done wrong and how can I fix it?

I'd like to get on with learning Git, but I can't focus on that if I am worried about the accuracy of my diff and merge tools (or the data they are working with.)


References

P4Merge: http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4MERGE.html
KDiff3: http://kdiff3.sourceforge.net/doc/documentation.html

I have three more, but I don't have enough reputation to post more links. They amount to Bitbucket, Araxis documentation, and a Stack Overflow page that references undocumented options/arguments/parameters in P4Merge. I'm not using Araxis, but they have some good instructions on where to find your conflict resolver settings in a number of different programs.


Creating the conflict

README.md (first version)

# This is my README  
This file has been modified BASE  

Pull.

README.md (edited, committed, approved through Bitbucket/webpage)

# This is my README  
This file has been modified SERVER  

README.md (modified locally)

# This is my README  
This file has been modified LOCAL  

Stash changes. Pull. Apply Stash. Congratulations! You now have a conflict that needs to be resolved.

0

There are 0 answers