summary refs log tree commit diff
path: root/git-mergetool.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-21 13:28:19 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-21 13:28:20 -0700
commit02f4db83bd979fe33f18006fa612d7d5ab1d2470 (patch)
treeb46eec9e6a6c9045c6a5819460d495f5519af6f4 /git-mergetool.sh
parent64bff25f78da5ae2e64f0598df20370c45aad7ef (diff)
parenteab335c46d6677ff50e9fe94352150641bc05507 (diff)
Merge branch 'da/mergetool-temporary-filename'
Tweak the names of the three throw-away files "git mergetool" comes
up with to feed the merge tool backend, so that a file with a
single dot in its name in the original (e.g. "hello.c") will have
only one dot in these variants (e.g. "hello_BASE_4321.c").

* da/mergetool-temporary-filename:
  mergetool: use more conservative temporary filenames
Diffstat (limited to 'git-mergetool.sh')
-rwxr-xr-xgit-mergetool.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 9a046b75d1..96a61ba6f4 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -228,11 +228,17 @@ merge_file () {
 		return 1
 	fi
 
-	ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
-	BACKUP="./$MERGED.BACKUP.$ext"
-	LOCAL="./$MERGED.LOCAL.$ext"
-	REMOTE="./$MERGED.REMOTE.$ext"
-	BASE="./$MERGED.BASE.$ext"
+	if BASE=$(expr "$MERGED" : '\(.*\)\.[^/]*$')
+	then
+		ext=$(expr "$MERGED" : '.*\(\.[^/]*\)$')
+	else
+		BASE=$MERGED
+		ext=
+	fi
+	BACKUP="./${BASE}_BACKUP_$$$ext"
+	LOCAL="./${BASE}_LOCAL_$$$ext"
+	REMOTE="./${BASE}_REMOTE_$$$ext"
+	BASE="./${BASE}_BASE_$$$ext"
 
 	base_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==1) print $1;}')
 	local_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==2) print $1;}')