Subject: Re: [PATCH v15 09/10] fetch: set remote/HEAD if it does not exist

From: "Bence Ferdinandy" <[email-masked]>
Date: Thu, 05 Dec 2024 21:57:11 +0100

On Thu Dec 05, 2024 at 21:11, Josh Steadmon <[email-masked]> wrote:
[snip]
>> 
>> Thanks for looking into this! I think the issue is with 
>> 
>>  $GIT fetch --tags "file://$REMOTE"
>> 
>> instead of adding a proper remote. Tbh, I've never seen the above syntax before, so first I just ran your script, which reproduced the issue for me, but then I modified it to use a proper remote which works as expected:
>> 
>> rm -rf test_tag_1 test_tag_2
>> GIT=~/git/bin-wrappers/git
>> mkdir test_tag_1 && cd test_tag_1
>> REMOTE=$(pwd)
>> $GIT init .
>> touch foo.txt
>> $GIT add foo.txt
>> $GIT commit foo.txt -m "commit one"
>> $GIT tag foo
>> cd ..
>> mkdir test_tag_2 && cd test_tag_2
>> $GIT init .
>> $GIT remote add origin $REMOTE
>> echo fetch --tags
>> $GIT fetch origin --tags 
>> echo regular fetch
>> $GIT fetch origin 'refs/tags/*:refs/tags/*'
>> $GIT --version
>> 
>> So I'm assuming this is why also the tests never caught this, since probably
>> all of them are using `git remote add`.
>> 
>
> Yeah, I think the issue is that we check the `--tags` flag first, but
> only add the ref_prefixes entry if it's not empty already. Then after
> that we unconditionally add HEAD. So that's why moving your strvec_push
> earlier fixes it. I'll send a fix + test patch in just a minute.

Awesome, thanks!