* [PATCH] Open external merge tool with original file extensions in all three files
@ 2007-12-03 15:31 Pini Reznik
2007-12-03 18:17 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Pini Reznik @ 2007-12-03 15:31 UTC (permalink / raw)
To: git; +Cc: Pini Reznik
This required to be able to use syntax highlighting in meld during conflicts resolution.
Before this change, two merged versions of file with a conflict were open with temporal extensions .LOCAL.$$ and REMOTE.$$
This way they were not recognized as a code files.
Signed-off-by: Pini Reznik <pinir@expand.com>
---
git-mergetool.sh | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 5587c5e..4c15d22 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.$$"
+ extension=`echo $path | awk -F \. '{print $NF}'`
+ BACKUP="$path.BACKUP.$$.${extension}"
+ LOCAL="$path.LOCAL.$$.${extension}"
+ REMOTE="$path.REMOTE.$$.${extension}"
+ BASE="$path.BASE.$$.${extension}"
mv -- "$path" "$BACKUP"
cp -- "$BACKUP" "$path"
--
1.5.3.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Open external merge tool with original file extensions in all three files
2007-12-03 15:31 [PATCH] Open external merge tool with original file extensions in all three files Pini Reznik
@ 2007-12-03 18:17 ` Junio C Hamano
2007-12-03 21:28 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-12-03 18:17 UTC (permalink / raw)
To: Pini Reznik; +Cc: git
Pini Reznik <pinir@expand.com> writes:
> This required to be able to use syntax highlighting in meld during
> conflicts resolution....
> + extension=`echo $path | awk -F \. '{print $NF}'`
> + BACKUP="$path.BACKUP.$$.${extension}"
> + LOCAL="$path.LOCAL.$$.${extension}"
> + REMOTE="$path.REMOTE.$$.${extension}"
> + BASE="$path.BASE.$$.${extension}"
I had to wonder what would happen in these cases:
* path = "a/b/c/d"
* path = "a/b.c/d"
I also think spawning awk for this is way overkill.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Open external merge tool with original file extensions in all three files
2007-12-03 18:17 ` Junio C Hamano
@ 2007-12-03 21:28 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-12-03 21:28 UTC (permalink / raw)
To: Pini Reznik; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Pini Reznik <pinir@expand.com> writes:
>
>> This required to be able to use syntax highlighting in meld during
>> conflicts resolution....
>
>> + extension=`echo $path | awk -F \. '{print $NF}'`
>> + BACKUP="$path.BACKUP.$$.${extension}"
>> + LOCAL="$path.LOCAL.$$.${extension}"
>> + REMOTE="$path.REMOTE.$$.${extension}"
>> + BASE="$path.BASE.$$.${extension}"
>
> I had to wonder what would happen in these cases:
>
> * path = "a/b/c/d"
> * path = "a/b.c/d"
>
> I also think spawning awk for this is way overkill.
IOW, I would probably write the above like this:
ext="$$$(expr "$path" : '.*\(\.[^/]*\)$')"
BACKUP="$path.BACKUP.$ext"
LOCAL="$path.LOCAL.$ext"
REMOTE="$path.REMOTE.$ext"
BASE="$path.BASE.$ext"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-03 21:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 15:31 [PATCH] Open external merge tool with original file extensions in all three files Pini Reznik
2007-12-03 18:17 ` Junio C Hamano
2007-12-03 21:28 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).