Re: [PATCH v6] log: "--since-as-filter" option is a non-terminating "--since" variant

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

 



Miklos Vajna <vmiklos@xxxxxxxxxx> writes:

> +test_expect_success 'git blame --since=...' '
> +	git blame --since="2020-02-15" file >actual &&
> +	cat >expect <<-\EOF &&
> +	^c7bc5ce (A U Thor 2020-02-01 00:00:00 +0000 1) a
> +	^c7bc5ce (A U Thor 2020-02-01 00:00:00 +0000 2) a
> +	33fc0d13 (A U Thor 2020-03-01 00:00:00 +0000 3) a
> +	ec76e003 (A U Thor 2020-04-01 00:00:00 +0000 4) a
> +	EOF
> +	test_cmp expect actual
> +'

Hardcoding the object names like this does not pass our test suite.
These abbreviated object names hardcode the use of SHA-1, but the
code is tested in repositories that use SHA-256 as well.

As you are creating four commits with distinct timestamps, I think
you can simply filter out the object name part for comparison,
perhaps like:

redact_blame_output () {
	sed -e 's/\([^]*\)\([0-9a-f]*\) /\1HASH /'
}

test_expect_success 'git blame --since=...' '
	git blame --since=2020-02-15 file >raw &&
	redact_blame_output <raw >actual &&
	redact_blame_output <<-\EOF &&
	^c7bc5ce (A U Thor 2020-02-01 00:00:00 +0000 1) a
	^c7bc5ce (A U Thor 2020-02-01 00:00:00 +0000 2) a
	33fc0d13 (A U Thor 2020-03-01 00:00:00 +0000 3) a
	ec76e003 (A U Thor 2020-04-01 00:00:00 +0000 4) a
	EOF
	test_cmp expect actual
'

But did you really mean to test how --since works with blame?  Given
that there does not seem to be any clock skew in the history being
tested, I am wondering if this new test file should even be a part
of the topic.

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