git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
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 22:23:43 -0700	[thread overview]
Message-ID: <xmqqv8pxm880.fsf@gitster.g> (raw)
In-Reply-To: <YxqiJW4cSp4cBR22@coredump.intra.peff.net> (Jeff King's message of "Thu, 8 Sep 2022 22:17:09 -0400")

Jeff King <peff@peff.net> writes:

> The code in fetch's add_merge_config() that does branch_merge_matches()
> comes from 85682c1903 (Correct handling of branch.$name.merge in
> builtin-fetch, 2007-09-18), but I don't see any indication there that
> non-qualified refs were intended.
>
> So I could either way: non-qualified refs in branch.*.merge has always
> worked, and we should continue to support it. Or it was never intended
> to work, and we are not obligated to continue supporting random things.

Yeah, it looks like it was working by accident.  I do not care too
deeply about folks who edit their configuration files to futz with
branch.<name>.merge, and "checkout -t -b" and "branch -t" commands
have been recording only full refs, so it is tempting to tighten
branch_merge_matches() to only allow full refname.  The only thing
that makes me hesitate to start writing code to do so is that some
third-party tools might have taken advantage of the fact that using
a branch-name was "working" by accident.

> I do think "continue supporting" would probably just mean using
> expand_ref_prefix() here as you suggest. It does increase the size of
> our request, and the work the server has to do when it matches the
> prefixes (which is inherently linear on the number of prefixes we give
> it).

Giving extra garbage to the set of prefixes does not hurt the
correctness, but we didn't add the extra prefix for
branch.<name>.merge before this fix, so not using
expand_ref_prefix() is not breaking anybody who weren't broken
before.  So I think it may be OK to support only the full refs at
first.  It's just that folks who didn't have full refname as the
value is not helped by our fix.

If enough folks complain that they have handcrafted (or prepared by
third-party tools) branch.<name>.merge that is not a full refname,
we could switch to expand_ref_prefix() and as long as the refnames
on the remote side is not ambiguous, things will still work
correctly, but I'd prefer to keep it tight until we actually hear
complaints.

Thanks.

  reply	other threads:[~2022-09-09  5:23 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
2022-09-09  2:17                           ` Jeff King
2022-09-09  5:23                             ` Junio C Hamano [this message]
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=xmqqv8pxm880.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).