Skip to content

Commit

Permalink
Merge branch 'da/mergetool-temporary-filename'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Oct 21, 2014
2 parents 64bff25 + eab335c commit 02f4db8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions git-mergetool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;}')
Expand Down

0 comments on commit 02f4db8

Please sign in to comment.