From: Junio C Hamano Date: Tue, 21 Oct 2014 20:28:19 +0000 (-0700) Subject: Merge branch 'da/mergetool-temporary-filename' X-Git-Tag: v2.2.0-rc0~30 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/02f4db83bd979fe33f18006fa612d7d5ab1d2470?hp=64bff25f78da5ae2e64f0598df20370c45aad7ef 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 --- 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;}')