Skip to content

Commit 02f4db8

Browse files
committed
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
2 parents 64bff25 + eab335c commit 02f4db8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

git-mergetool.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,17 @@ merge_file () {
228228
return 1
229229
fi
230230

231-
ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
232-
BACKUP="./$MERGED.BACKUP.$ext"
233-
LOCAL="./$MERGED.LOCAL.$ext"
234-
REMOTE="./$MERGED.REMOTE.$ext"
235-
BASE="./$MERGED.BASE.$ext"
231+
if BASE=$(expr "$MERGED" : '\(.*\)\.[^/]*$')
232+
then
233+
ext=$(expr "$MERGED" : '.*\(\.[^/]*\)$')
234+
else
235+
BASE=$MERGED
236+
ext=
237+
fi
238+
BACKUP="./${BASE}_BACKUP_$$$ext"
239+
LOCAL="./${BASE}_LOCAL_$$$ext"
240+
REMOTE="./${BASE}_REMOTE_$$$ext"
241+
BASE="./${BASE}_BASE_$$$ext"
236242

237243
base_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==1) print $1;}')
238244
local_mode=$(git ls-files -u -- "$MERGED" | awk '{if ($3==2) print $1;}')

0 commit comments

Comments
 (0)