git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2007, 21:28 UTC
Message-ID
<7vlk8bh3iw.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7v63zfiqx8.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> 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"
Previous: Junio C Hamano
Message 3 of 3 in “Open external merge tool with original file extensions in all three files”
  1. Open external merge tool with original file extensions in all three filesPini Reznik, Dec 3, 2007
  2. Junio C HamanoDec 3, 2007
  3. Junio C HamanoDec 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.