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

Re: [PATCH 2/2] t7900: clean up some broken refs

From
Derrick Stolee <stolee@gmail.com>
Date
Jan 18, 2021, 18:24 UTC
Message-ID
<c6e486cc-11f7-5e10-50fd-5023f4ea086a@gmail.com>
In-Reply-To
<YAWxh8O/XlxIfcv3@nand.local>
On 1/18/2021 11:04 AM, Taylor Blau wrote:
Show 8 quoted lines
> On Mon, Jan 18, 2021 at 03:23:36AM +0000, Derrick Stolee via GitGitGadget wrote:
>> This only shows up if you run the tests verbosely and watch the output.
>> It caught my eye and I _thought_ that there was a bug where 'git gc' or
>> 'git repack' wouldn't check 'refs/prefetch/' before pruning objects.
>> That is incorrect. Those commands do handle 'refs/prefetch/' correctly.
> 
> Do you think it would be worth checking that 'does not point to a valid
> object' doesn't appear in the output?

Perhaps, but I think this isn't an actually interesting behavior to test. It's really the test that was broken, not Git itself.

Show 31 quoted lines
>> All that is left is to clean up the tests in t7900-maintenance.sh to
>> remove these tags and refs that are not being repacked for the
>> incremental-repack tests.
>>
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
>> ---
>>  t/t7900-maintenance.sh | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
>> index f9031cbb44b..6be9d42767a 100755
>> --- a/t/t7900-maintenance.sh
>> +++ b/t/t7900-maintenance.sh
>> @@ -256,6 +256,11 @@ test_expect_success 'incremental-repack task' '
>>  	HEAD
>>  	^HEAD~1
>>  	EOF
>> +
>> +	# Replace the object directory with this pack layout.
>> +	# However, it does not include all objects from the remotes.
>> +	rm -rf .git/refs/prefetch &&
>> +	rm -rf .git/refs/tags &&
> 
> Hmm. Makes sense, but this will certainly need to be updated to work
> with reftables, and it would break if you ran 'git pack-refs'.
> 
> Perhaps instead:
> 
>   git for-each-ref --format='delete %(refname)' \
>     refs/prefetch refs/tags >refs &&
>   git update-ref --stdin <refs

Deleting refs in a clean way is probably good to do. I'm guessing you didn't use a pipe because it can be hard to diagnose a failure in the chain? That's probably reasonable.

Thanks, -Stolee

Previous: Taylor BlauNext: Derrick Stolee via GitGitGadget
Message 6 of 13 in “Two cleanups around 'prefetch' refs”
  1. 0/2 Two cleanups around 'prefetch' refsDerrick Stolee via GitGitGadget, Jan 18, 2021
  2. 1/2 maintenance: set log.excludeDecoration durin prefetchDerrick Stolee via GitGitGadget, Jan 18, 2021
  3. Taylor BlauJan 18, 2021
  4. 2/2 t7900: clean up some broken refsDerrick Stolee via GitGitGadget, Jan 18, 2021
  5. Taylor BlauJan 18, 2021
  6. Derrick StoleeJan 18, 2021
  7. 0/2 Two cleanups around 'prefetch' refsDerrick Stolee via GitGitGadget, Jan 19, 2021
  8. 1/2 maintenance: set log.excludeDecoration durin prefetchDerrick Stolee via GitGitGadget, Jan 19, 2021
  9. Junio C HamanoJan 21, 2021
  10. 2/2 t7900: clean up some broken refsDerrick Stolee via GitGitGadget, Jan 19, 2021
  11. Junio C HamanoJan 21, 2021
  12. Taylor BlauJan 19, 2021
  13. Junio C HamanoJan 21, 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.