Re: [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension

2 messages, 2 authors, 2022-09-11 · open the first message on its own page

Re: [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension

From: Junio C Hamano <hidden>
Date: 2022-09-09 05:23:50

Jeff King [off-list ref] 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.

Re: [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension

From: Jeff King <hidden>
Date: 2022-09-11 05:08:28

On Thu, Sep 08, 2022 at 10:23:43PM -0700, Junio C Hamano wrote:
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.
Right. My patch is a strict improvement. I just wasn't sure if we should
go further while we are here.
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.
OK, that matches my feeling, too. So I think the series as-is should be
fine.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help