mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
950b5680bd
Use $TMPDIR when creating the /dev/null placeholder for p4merge. This prevents users from finding a seemingly random untracked file in their worktree. This is different than what mergetool does with $LOCAL and $REMOTE because those files exist to aid users when resolving merges. p4merge's /dev/null placeholder is not helpful in that situation so it is sensible to keep it out of the worktree. Reported-by: Jeremy Morton <admin@game-point.net> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
35 lines
578 B
Plaintext
35 lines
578 B
Plaintext
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 () {
|
|
touch "$BACKUP"
|
|
$base_present || >"$BASE"
|
|
"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
|
|
check_unchanged
|
|
}
|
|
|
|
create_empty_file () {
|
|
empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$"
|
|
>"$empty_file"
|
|
|
|
printf "$empty_file"
|
|
}
|