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

Re: p2000 failure due to empty reflog

From
René Scharfe <l.s.r@web.de>
Date
Oct 9, 2021, 14:39 UTC
Message-ID
<23cfe67d-5a7c-6525-cb50-396cbd1121c6@web.de>
In-Reply-To
<8735pfjg47.fsf@evledraar.gmail.com>
Am 05.10.21 um 23:38 schrieb Ævar Arnfjörð Bjarmason:
Show 43 quoted lines
>
> On Mon, Oct 04 2021, Derrick Stolee wrote:
>
>> On 10/2/2021 1:37 PM, René Scharfe wrote:
>>> p2000 fails for me and reports:
>>>
>>>    perf 18 - git checkout -f - (full-v3):
>>>    running:
>>>    			(
>>>    				cd full-v3 &&
>>>    				echo >>f2/f4/a &&
>>>    				git checkout -f -
>>>    			)
>>>
>>>    error: pathspec '-' did not match any file(s) known to git
>>>
>>> checkout fails because the reflog is empty, so the "-" can't be
>>> resolved.  The pathspec error message is confusing, though.
>>>
>>> The patch below adds a reflog entry and allows the script to
>>> succeed.
>>>
>>> Before the "test_perf_on_all git commit -a -m A", there are two
>>> reflog entries in each of the five clones, after it there are
>>> none.  How is that even possible?
>>
>> That is certainly confusing. Is there something about your global
>> (or local to your test repo) GC settings that cause an auto-GC to
>> prune the reflog aggressively?
>
> Perhaps something to do with certain parts of the code doing a
> time(NULL), and other parts faking up times to be 2005-something?
>
> I have some WIP patches that run concurrent "git gc --auto" with a
> detach across the whole test suite, and IIRC I had to search/replace all
> time(NULL) with my own time() that faked up (looks it up) an epoch of
> 1113465166 to avoid this exact issue.
>
> If you try doing that across our tests I think you'll find that the
> @{-1} syntax (reflog-powered) will start failing.
>
> But that's from vague memory, but perhaps it'll point you in the right
> direction...

Yes, that helped. The reflog entries have fake dates in 2005, and "git reflog expire --all" called by "git gc --auto" deletes entries older than 90 days based on the actual current time.

René
Previous: Ævar Arnfjörð Bjarmason
Message 10 of 10 in “p2000 failure due to empty reflog”
  1. René ScharfeOct 2, 2021
  2. Derrick StoleeOct 4, 2021
  3. René ScharfeOct 5, 2021
  4. Junio C HamanoOct 6, 2021
  5. perf: disable automatic housekeepingRené Scharfe, Oct 9, 2021
  6. "git reflog expire" blindly trusting timestamps in reflogsÆvar Arnfjörð Bjarmason, Oct 9, 2021
  7. Junio C HamanoOct 9, 2021
  8. Jeff KingOct 11, 2021
  9. Ævar Arnfjörð BjarmasonOct 5, 2021
  10. René ScharfeOct 9, 2021

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.