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

Re: [PATCH v2] mergetool: use more conservative temporary filenames

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2014, 21:16 UTC
Message-ID
<xmqq38av62x0.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5437C0CC.7030102@gmail.com>
Jakub Narębski <jnareb@gmail.com> writes:
Show 6 quoted lines
> Why use expr and not POSIX shell parameter substitution?
>
> BASE=${MERGED%.*}
> ext=.${MERGED##*.}
>
> Or something like that...
Because they are insufficient.  See David's illustrations for how.

Parameter expansion (e.g. ${parameter%word}) is fine for the simplest cases (e.g. you know there is .c suffix to the $string and want to strip it out) but not sufficient for other cases (e.g. you may not even know if there is any suffix). You can deconstruct your regexps manually and use conditional if/else/fi if you are unable to use expr, but I do not see how it buys us anything.

Previous: Johannes SixtNext: Junio C Hamano
Message 5 of 6 in “mergetool: use more conservative temporary filenames”
  1. mergetool: use more conservative temporary filenamesDavid Aguilar, Oct 10, 2014
  2. Jakub NarębskiOct 10, 2014
  3. David AguilarOct 10, 2014
  4. Johannes SixtOct 10, 2014
  5. Junio C HamanoOct 10, 2014
  6. Junio C HamanoOct 13, 2014

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.