Web lists-archives.com

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




Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Sun, Feb 3, 2019 at 4:01 PM Sven van Haastregt <svenvh@xxxxxxxxx> 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?


>
>> Signed-off-by: Sven van Haastregt <svenvh@xxxxxxxxx>
>> ---
>> Differences since v2: Simplify code as suggested by Eric
>> Sunshine <sunshine@xxxxxxxxxxxxxx> and suppress stderr.
>
> This version looks better. Thanks.