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

Re: A note on modern git plus ancient meld ("wrong number of arguments")

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 10, 2012, 17:59 UTC
Message-ID
<20120210175915.GB19216@burratino>
In-Reply-To
<CAHGBnuPBDO=tnoDFGOcGz4nZh9O_A803STmj7KALLuhwgf=hCg@mail.gmail.com>
Hi,
Sebastian Schuberth wrote:
> On Fri, Feb 10, 2012 at 09:23, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 5 quoted lines
>> +       meld_version=${meld_version#GNOME }
>> +       meld_version=${meld_version#* }
>
> Hmm, I might be mistaken, but aren't these string operations
> Bash-only? And AFAIK Git is striving for standard sh compatibility ...

They are widely supported in POSIX-style shells. See [1] and Documentation/CodingGuidelines:

 - We use POSIX compliant parameter substitutions and avoid bashisms;
   namely:
   - We use ${parameter-word} and its [-=?+] siblings, and their
     colon'ed "unset or null" form.
   - We use ${parameter#word} and its [#%] siblings, and their
     doubled "longest matching" form.

A good way to catch these things is to try with dash or posh, which are a little less full-featured than bash and ksh.

Thanks for looking it over. Jonathan

[1] http://pubs.opengroup.org/onlinepubs/9699919799/ Search for "sh -".

Previous: Sebastian SchuberthNext: Junio C Hamano
Message 5 of 9 in “A note on modern git plus ancient meld ("wrong number of arguments")”
  1. Jeff EplerFeb 9, 2012
  2. David AguilarFeb 10, 2012
  3. Jonathan NiederFeb 10, 2012
  4. Sebastian SchuberthFeb 10, 2012
  5. Jonathan NiederFeb 10, 2012
  6. Junio C HamanoFeb 10, 2012
  7. mergetools/meld: Use --help output to detect --output supportJonathan Nieder, Feb 10, 2012
  8. Jeff EplerFeb 10, 2012
  9. Jeff EplerFeb 10, 2012

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.