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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 22, 2022, 23:43 UTC
Message-ID
<xmqqsfq44rc6.fsf@gitster.g>
In-Reply-To
<YmMJqvKN6itSHEZW@vmiklos.hu>
Miklos Vajna <vmiklos@vmiklos.hu> writes:
Show 10 quoted lines
> +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.
Previous: Miklos Vajna
Message 24 of 24 in “git log --since to not stop after first old commit?”
  1. Miklos VajnaApr 1, 2022
  2. Ævar Arnfjörð BjarmasonApr 1, 2022
  3. Miklos VajnaApr 1, 2022
  4. Ævar Arnfjörð BjarmasonApr 1, 2022
  5. Junio C HamanoApr 1, 2022
  6. git-log: add a --since-as-filter optionMiklos Vajna, Apr 1, 2022
  7. git-log: add a --since-as-filter optionMiklos Vajna, Apr 2, 2022
  8. Miklos VajnaApr 7, 2022
  9. Junio C HamanoApr 8, 2022
  10. Junio C HamanoApr 8, 2022
  11. git-log: add a --since=... --as-filter optionMiklos Vajna, Apr 8, 2022
  12. Ævar Arnfjörð BjarmasonApr 12, 2022
  13. git-log: add a --since=... --as-filter optionMiklos Vajna, Apr 15, 2022
  14. Junio C HamanoApr 15, 2022
  15. log: "--as-filter" option adjusts how "--since" cut-off worksMiklos Vajna, Apr 16, 2022
  16. Miklos VajnaApr 22, 2022
  17. Miklos VajnaApr 11, 2022
  18. demerphqApr 11, 2022
  19. Junio C HamanoApr 11, 2022
  20. Junio C HamanoApr 22, 2022
  21. log: "--since-as-filter" option is a non-terminating "--since" variantMiklos Vajna, Apr 22, 2022
  22. Junio C HamanoApr 22, 2022
  23. log: "--since-as-filter" option is a non-terminating "--since" variantMiklos Vajna, Apr 23, 2022
  24. Junio C HamanoApr 22, 2022

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.