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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 4, 2019, 18:47 UTC
Message-ID
<xmqqftt3v1ah.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cQXuzMwZjHa3n+DwRFL3E76U8uAvhiFiC5S=B23f03Vnw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 15 quoted lines
> On Sun, Feb 3, 2019 at 4:01 PM Sven van Haastregt <svenvh@gmail.com> wrote:
>> Until now, `git submodule summary` was always emitting 7-character
>> SHA-1s that have a higher chance of being ambiguous for larger
>> repositories.  Use `git rev-parse --short` instead, which will
>> determine suitable short SHA-1 lengths.
>>
>> We cannot always rely on successfully invoking `git rev-parse` in the
>> submodule directory.  Keep the old method using `cut` as a fallback.
>
> Reviewers and future readers of this patch are left in the dark
> regarding the circumstances in which git-rev-parse may fail in the
> submodule directory. It would be helpful for the commit message to
> explain this potential failure in enough detail for someone working in
> this area in the future to understand any implications of changes to
> this code.
Replace that problematic sentence with something like
	As a submodule may not be initialized with "submodule init"
	or not cloned, `git rev-parse` may not work in it yet; as a
	fallback, use the original method of cutting at 7 hexdigits.
perhaps?
Show 7 quoted lines
>
>> Signed-off-by: Sven van Haastregt <svenvh@gmail.com>
>> ---
>> Differences since v2: Simplify code as suggested by Eric
>> Sunshine <sunshine@sunshineco.com> and suppress stderr.
>
> This version looks better. Thanks.
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 4 in “git-submodule.sh: shorten submodule SHA-1s using rev-parse”
  1. git-submodule.sh: shorten submodule SHA-1s using rev-parseSven van Haastregt, Feb 3, 2019
  2. Eric SunshineFeb 3, 2019
  3. Junio C HamanoFeb 4, 2019
  4. Eric SunshineFeb 4, 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.