diff options
Diffstat (limited to 'mergetools')
-rw-r--r-- | mergetools/codecompare | 25 | ||||
-rw-r--r-- | mergetools/defaults | 28 | ||||
-rw-r--r-- | mergetools/p4merge | 24 |
3 files changed, 51 insertions, 26 deletions
diff --git a/mergetools/codecompare b/mergetools/codecompare new file mode 100644 index 0000000000..3f0486bc80 --- /dev/null +++ b/mergetools/codecompare @@ -0,0 +1,25 @@ +diff_cmd () { + "$merge_tool_path" "$LOCAL" "$REMOTE" +} + +merge_cmd () { + touch "$BACKUP" + if $base_present + then + "$merge_tool_path" -MF="$LOCAL" -TF="$REMOTE" -BF="$BASE" \ + -RF="$MERGED" + else + "$merge_tool_path" -MF="$LOCAL" -TF="$REMOTE" \ + -RF="$MERGED" + fi + check_unchanged +} + +translate_merge_tool_path() { + if merge_mode + then + echo CodeMerge + else + echo CodeCompare + fi +} diff --git a/mergetools/defaults b/mergetools/defaults index 1d8f2a3dd3..21e63ecc3e 100644 --- a/mergetools/defaults +++ b/mergetools/defaults @@ -8,36 +8,12 @@ can_diff () { } diff_cmd () { - merge_tool_cmd="$(get_merge_tool_cmd "$1")" - if test -z "$merge_tool_cmd" - then - status=1 - break - fi - ( eval $merge_tool_cmd ) - status=$? + status=1 return $status } merge_cmd () { - merge_tool_cmd="$(get_merge_tool_cmd "$1")" - if test -z "$merge_tool_cmd" - then - status=1 - break - fi - trust_exit_code="$(git config --bool \ - mergetool."$1".trustExitCode || echo false)" - if test "$trust_exit_code" = "false" - then - touch "$BACKUP" - ( eval $merge_tool_cmd ) - status=$? - check_unchanged - else - ( eval $merge_tool_cmd ) - status=$? - fi + status=1 return $status } diff --git a/mergetools/p4merge b/mergetools/p4merge index 1a45c1b0c5..8a36916567 100644 --- a/mergetools/p4merge +++ b/mergetools/p4merge @@ -1,5 +1,22 @@ diff_cmd () { + empty_file= + + # p4merge does not like /dev/null + if test "/dev/null" = "$LOCAL" + then + LOCAL="$(create_empty_file)" + fi + if test "/dev/null" = "$REMOTE" + then + REMOTE="$(create_empty_file)" + fi + "$merge_tool_path" "$LOCAL" "$REMOTE" + + if test -n "$empty_file" + then + rm -f "$empty_file" + fi } merge_cmd () { @@ -8,3 +25,10 @@ merge_cmd () { "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED" check_unchanged } + +create_empty_file () { + empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$" + >"$empty_file" + + printf "%s" "$empty_file" +} |