p4Merge bundled command and the behaviour with files (same name) added on different branches.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

Hopefully a quick question.  Given the following scenario

mkdir git_repo
cd git_repo
git init
echo foo > foo.txt
git add foo.txt
git commit -m "Initial commit"
git checkout -b other
echo bar > bar.txt
git add bar.txt
git commit -m "other commit"
git checkout master
echo barbarella > bar.txt
git add bar.txt
git commit -m "master commit"
git merge other

We would expect a 'both added' merge conflict (both the other branch,
and the master branch added the file named bar.txt, but with different
content.)  This is all good and right.  So in a system configured to
use p4merge as the mergetool, one fires up with 'git mergetool'

What happens now is p4merge starts and tells us:

Base: bar.txt.LOCAL.<num1>.txt
Left: bar.txt.LOCAL.<num1>.txt Differences from base: 0
Right: bar.txt.LOCAL.<num2>.txt Differences from base: 1
Merge: bar.txt Conflicts:0

Presenting the left + right options on top of each other in the result
window (which may be correct) and leaving the save button disabled
(grayed out)

If at this point one closes the window without editing the presented
(apparently merged) file, then nothing will be saved to disk and we
will see:

bar.txt seems unchanged.
Was the merge successful? [y/n]

In the console.  Which Git wise is correct, that is exactly right, the
p4merge tool hasn't made any actual changes to the underlying file.

This behaviour seems confusing to me (the p4merge client behaviour,
*not* Git's)   I believe it is because in the case where there is no
logical base between two files the local one is arbritrarily chosen,
and p4merge *thinks* that this is equal to the merge result and has
nothing to persist.

I have attached a patch that resolves the issue for me (e.g.
introduces the behaviour I expect) by passing a reference to an empty
file in the case where there is no meaningful base.  Unfortunately I
don't understand enough to say whether this change is correct or not
and would value feedback on it.

Many thanks
 - Cj.

Attachment: 0001-Modified-the-p4merge-client-command-to-pass-a-refere.patch
Description: Binary data


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]