Skip to content

Commit 0a0ec7b

Browse files
ciaranjgitster
authored andcommitted
Pass empty file to p4merge where no base is suitable.
Modify the p4merge client command to pass a reference to an empty file instead of the local file when no base revision available. In the situation where a merge tries to add a file from one branch into a branch that already contains that file (by name), p4merge currently seems to have successfully automatically resolved the 'conflict' when it is opened (correctly if the files differed by just whitespace for example) but leaves the save button disabled. This means the user of the p4merge client cannot commit the resolved changes back to disk and merely exits, leaving the original (merge-conflicted) file intact on the disk. Provide an empty base file to p4merge so that it leaves the save button enabled. This will allow saving of the auto-resolution to disk. Signed-off-by: Ciaran Jessup <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec014ea commit 0a0ec7b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

git-mergetool--lib.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,9 @@ run_merge_tool () {
258258
;;
259259
p4merge)
260260
if merge_mode; then
261-
touch "$BACKUP"
262-
if $base_present; then
263-
"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
264-
else
265-
"$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
266-
fi
261+
touch "$BACKUP"
262+
$base_present || >"$BASE"
263+
"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
267264
check_unchanged
268265
else
269266
"$merge_tool_path" "$LOCAL" "$REMOTE"

0 commit comments

Comments
 (0)