From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Lana Deere" <lana.deere@gmail.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension
Date: Thu, 08 Sep 2022 13:48:38 -0700 [thread overview]
Message-ID: <xmqqtu5hoamx.fsf@gitster.g> (raw)
In-Reply-To: <xmqq1qslpprv.fsf@gitster.g> (Junio C. Hamano's message of "Thu, 08 Sep 2022 13:36:20 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> So, is strvec_push() a correct thing to use here? ref_prefixes will
> receive something like 'master' here, without 'refs/heads/master'
> getting pushed, when "branch.*.merge = master"? Given that the
> advertisement restriction is merely an optimization, I wouldn't be
> surprised if 'master' in .ref_prefixes strvec is further expanded
> by an unnecessary extra call to expand_ref_prefix() later to cause
> the server side to advertise refs/heads/master and refs/tags/master
> etc., but it smells, eh, bad.
>
>> if (tags == TAGS_SET || tags == TAGS_DEFAULT) {
>> must_list_refs = 1;
>> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
>> index 081808009b..0b72112fb1 100755
>> --- a/t/t5520-pull.sh
>> +++ b/t/t5520-pull.sh
>> @@ -218,6 +218,23 @@ test_expect_success 'fail if upstream branch does not exist' '
>> test_cmp expect file
>> '
>>
>> +test_expect_success 'fetch upstream branch even if refspec excludes it' '
>> + # the branch names are not important here except that
>> + # the first one must not be a prefix of the second,
>> + # since otherwise the ref-prefix protocol extension
>> + # would match both
>> + git branch in-refspec HEAD^ &&
>> + git branch not-in-refspec HEAD &&
>> + git init -b in-refspec downstream &&
>> + git -C downstream remote add -t in-refspec origin "file://$(pwd)/.git" &&
>> + git -C downstream config branch.in-refspec.remote origin &&
>> + git -C downstream config branch.in-refspec.merge refs/heads/not-in-refspec &&
Ah, OK, so the breakage may be the other way around.
The new code assumes that branch.<name>.merge is a full refname, and
strvec_push() is the right thing to do, when we add the knowledge
that the current branch we are on by default merges with their
refs/heads/frotz. We just ask them to advertise refs/heads/frotz
and they do not need to advertise refs/tags/frotz etc. let alone
refs/tags/refs/heads/frotz so using expand_ref_prefix() here is
wrong.
It means that the patch claims that remote.c::branch_merge_matches()
assume that branch->merge[i]->src may not be a full refname by
calling refname_match() on it, which is incorrect and may need to be
corrected. But that is totally outside the scope of this fix.
Thanks.
next prev parent reply other threads:[~2022-09-08 20:48 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 19:27 2.37.2 can't "git pull" but 2.18.0 can Lana Deere
2022-09-02 20:16 ` brian m. carlson
2022-09-06 18:26 ` Lana Deere
2022-09-07 12:59 ` Johannes Schindelin
2022-09-07 15:59 ` Lana Deere
2022-09-08 18:20 ` Jeff King
2022-09-03 1:07 ` Jeff King
2022-09-06 19:37 ` Lana Deere
2022-09-07 2:11 ` Đoàn Trần Công Danh
2022-09-07 15:56 ` Lana Deere
2022-09-07 18:21 ` Jeff King
2022-09-07 18:53 ` Lana Deere
2022-09-07 21:10 ` Jeff King
2022-09-08 16:46 ` Lana Deere
2022-09-08 18:14 ` Jeff King
2022-09-08 19:23 ` [PATCH 0/2] v2 protocol can't "git pull" with restricted refspec Jeff King
2022-09-08 19:24 ` [PATCH 1/2] fetch: stop checking for NULL transport->remote in do_fetch() Jeff King
2022-09-08 19:26 ` [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension Jeff King
2022-09-08 20:36 ` Junio C Hamano
2022-09-08 20:48 ` Junio C Hamano [this message]
2022-09-09 2:17 ` Jeff King
2022-09-09 5:23 ` Junio C Hamano
2022-09-11 5:08 ` Jeff King
2022-09-09 17:32 ` 2.37.2 can't "git pull" but 2.18.0 can Lana Deere
2022-09-09 18:27 ` Junio C Hamano
2022-09-12 14:58 ` Lana Deere
2022-09-13 0:28 ` Jeff King
2022-09-05 10:25 ` Johannes Schindelin
2022-09-06 18:38 ` Lana Deere
2022-09-07 10:20 ` Johannes Schindelin
2022-09-07 16:01 ` Lana Deere
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtu5hoamx.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
--cc=lana.deere@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).