[PATCH] mergetools/p4merge: Handle "/dev/null"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



p4merge does not properly handle the case where "/dev/null"
is passed as a filename.

Workaround it by creating a temporary file for this purpose.

Reported-by: Jeremy Morton <admin@xxxxxxxxxxxxxx>
Signed-off-by: David Aguilar <davvid@xxxxxxxxx>
---
Jeremy, can you test this?

 mergetools/p4merge | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/mergetools/p4merge b/mergetools/p4merge
index 1a45c1b..295361a 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 () {
-- 
1.8.0.rc1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]