From: David Aguilar Date: Thu, 11 Oct 2012 03:22:36 +0000 (-0700) Subject: mergetools/p4merge: Handle "/dev/null" X-Git-Tag: v1.8.0.1~21^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3facc60031a5b860cae8cb26957e5b4e80820c34;p=git.git 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 Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- Needs to be amended with Tested-by when a report comes... --- diff --git a/mergetools/p4merge b/mergetools/p4merge index 1a45c1b0c..295361a8a 100644 --- a/mergetools/p4merge +++ b/mergetools/p4merge @@ -1,5 +1,30 @@ diff_cmd () { + # p4merge does not like /dev/null + rm_local= + rm_remote= + if test "/dev/null" = "$LOCAL" + then + LOCAL="./p4merge-dev-null.LOCAL.$$" + >"$LOCAL" + rm_local=true + fi + if test "/dev/null" = "$REMOTE" + then + REMOTE="./p4merge-dev-null.REMOTE.$$" + >"$REMOTE" + rm_remote=true + fi + "$merge_tool_path" "$LOCAL" "$REMOTE" + + if test -n "$rm_local" + then + rm -f "$LOCAL" + fi + if test -n "$rm_remote" + then + rm -f "$REMOTE" + fi } merge_cmd () {