Re: [PATCH 3/4] shortlog tests: rewrite to get rid of --abbrev=35 hardcoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> +	cat >expect <<-EOF &&
> +	A U Thor (5):
> +	      $(git rev-parse HEAD~5)
> +	      $(git rev-parse HEAD~4)
> +	      $(git rev-parse HEAD~3)
> +	      $(git rev-parse HEAD~2)
> +	      $(git rev-parse HEAD~1)
> +
> +	Someone else (1):
> +	      $(git rev-parse HEAD~0)
> +
> +	EOF
> ...
>  test_expect_success '--abbrev' '
> -	sed s/SUBJECT/OBJID/ expect.template >expect &&
> +	cut -c 1-41 <expect >expect.abbrev &&
>  	git shortlog --format="%h" --abbrev=35 HEAD >log &&

The hardcoded 35 is a bit curious, and 1-41 even more so.

Is the idea that the "expect" prepared earlier has full hexdigits
and indented by 6 columns, the full hexdigits for an object name is
longer than 35 chars in any hash algorithm we use, any sample name
plus (number) plus colon won't be 35 chars long, and 35+6 happens to
be 41 so cutting at 41 column we'd get the first 35 hexdigits of the
object names without losing anything on the summary line?

That's a bit too subtle to my taste, but 

	test_expect_success '--abbrev' '
		abbrev=35 &&
		cut -c 1-$(( abbrev + 6 )) expect >expect.abbrev &&
		git shortlog --format="%h" --abbrev=$abbrev HEAD >log &&
		...

may not make it much easier to follow (without explaining what that
6 is anyway), so I'll let it pass.

Otherwise the steps so far make quite a lot of sense.

Thanks.










[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux