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

Re: [PATCH v2] git-submodule.sh: shorten submodule SHA-1s using rev-parse

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 28, 2019, 02:33 UTC
Message-ID
<xmqqy375bjen.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cRLLTYB=tVOY39dojLYZqoX=yxPRZY9fjo9z+5+P2BKKg@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 13 quoted lines
> This could be made a bit easier to follow by using indentation and ||
> rather than &&. For instance, rewriting the entire block as:
>
>     # Shorten with hard-coded fallback if rev-parse fails
>     sha1_abbr_src=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_src ||
>         echo $sha1_src | cut -c1-7)
>     sha1_abbr_dst=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_dst ||
>         echo $sha1_dst | cut -c1-7)
>
> In fact, the code is clear enough that the comment isn't even needed.
>
> By the way, if git-rev-parse does fail, is it going to produce an
> error message on stderr that needs to be suppressed?
All good points ;-).
Previous: Eric Sunshine
Message 3 of 3 in “git-submodule.sh: shorten submodule SHA-1s using rev-parse”
  1. git-submodule.sh: shorten submodule SHA-1s using rev-parseSven van Haastregt, Jan 27, 2019
  2. Eric SunshineJan 27, 2019
  3. Junio C HamanoJan 28, 2019

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.