mergetools/p4merge: create a base if none available
[gitweb.git] / mergetools / p4merge
index 52f7c8f70578929432becdd58a7fb423398f8de8..5a608abf9c77f436ab1472592e3d5777ef83805d 100644 (file)
@@ -21,8 +21,12 @@ diff_cmd () {
 
 merge_cmd () {
        touch "$BACKUP"
-       $base_present || >"$BASE"
-       "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
+       if ! $base_present
+       then
+               cp -- "$LOCAL" "$BASE"
+               create_virtual_base "$BASE" "$REMOTE"
+       fi
+       "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
        check_unchanged
 }
 
@@ -30,5 +34,5 @@ create_empty_file () {
        empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$"
        >"$empty_file"
 
-       printf "$empty_file"
+       printf "%s" "$empty_file"
 }