Skip to content

Commit 3facc60

Browse files
davvidgitster
authored andcommitted
mergetools/p4merge: Handle "/dev/null"
p4merge does not properly handle the case where "/dev/null" is passed as a filename. Work it around by creating a temporary file for this purpose. Reported-by: Jeremy Morton <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> --- Needs to be amended with Tested-by when a report comes...
1 parent 40701ad commit 3facc60

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

mergetools/p4merge

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
diff_cmd () {
2+
# p4merge does not like /dev/null
3+
rm_local=
4+
rm_remote=
5+
if test "/dev/null" = "$LOCAL"
6+
then
7+
LOCAL="./p4merge-dev-null.LOCAL.$$"
8+
>"$LOCAL"
9+
rm_local=true
10+
fi
11+
if test "/dev/null" = "$REMOTE"
12+
then
13+
REMOTE="./p4merge-dev-null.REMOTE.$$"
14+
>"$REMOTE"
15+
rm_remote=true
16+
fi
17+
218
"$merge_tool_path" "$LOCAL" "$REMOTE"
19+
20+
if test -n "$rm_local"
21+
then
22+
rm -f "$LOCAL"
23+
fi
24+
if test -n "$rm_remote"
25+
then
26+
rm -f "$REMOTE"
27+
fi
328
}
429

530
merge_cmd () {

0 commit comments

Comments
 (0)