threads / patch / 11138

patchOpen external merge tool with original file extensions for all three files

Subject: [PATCH] Open external merge tool with original file extensions for all three files

## tl;dr

2 messages between Dec 5, 2007 and Dec 5, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Pini Reznik· Dec 5, 2007, 07:19 UTC · lore

Before this fix conflicted files were open in external merge tool with temporal extensions like REMOTE.$$ and LOCAL.$$. This way meld was unable to recognize these files and syntax highlighting feature was unusable.

Signed-off-by: Pini Reznik <pinir@expand.com>
---
 git-mergetool.sh |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
Show changes to git-mergetool.sh +5 −4
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 5587c5e..2f31fa2 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -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"
-- 
1.5.3.5
Junio C Hamano· Dec 5, 2007, 07:24 UTC · re: Pini Reznik · lore

Re: [PATCH] Open external merge tool with original file extensions for all three files

Pini Reznik <pinir@expand.com> writes:
Show 5 quoted lines
> Before this fix conflicted files were open in external merge tool with temporal extensions like REMOTE.$$ and LOCAL.$$.
> This way meld was unable to recognize these files and syntax highlighting feature was unusable.
>
>
> Signed-off-by: Pini Reznik <pinir@expand.com>

I have to wonder if it is fashionable to use overlooooong lines on this list today... Please linewrap commit log message.

Ted, you added meld from the beginning to git-mergetool. Does the patch look good?

Show 21 quoted lines
> ---
>  git-mergetool.sh |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index 5587c5e..2f31fa2 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -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"

I realize '.*\(\.[^./]*\)$' might have been better, as the above expression as written will slurp ".b.c" as ext from "foo.b.c", but probably for "merger knows the file type with file extension" purpose, it does not make a difference.

← back to recent threads