diff: do not chomp hunk-header in the middle of a character
[gitweb.git] / git-mergetool.sh
index 5587c5ecea0f6a97f2715636890c9e2f89845d52..2f31fa2417300180662b66afdde11bdf1d6febb2 100755 (executable)
@@ -152,10 +152,11 @@ merge_file () {
        exit 1
     fi
 
-    BACKUP="$path.BACKUP.$$"
-    LOCAL="$path.LOCAL.$$"
-    REMOTE="$path.REMOTE.$$"
-    BASE="$path.BASE.$$"
+    ext="$$$(expr "$path" : '.*\(\.[^/]*\)$')"
+    BACKUP="$path.BACKUP.$ext"
+    LOCAL="$path.LOCAL.$ext"
+    REMOTE="$path.REMOTE.$ext"
+    BASE="$path.BASE.$ext"
 
     mv -- "$path" "$BACKUP"
     cp -- "$BACKUP" "$path"