Re: [PATCH v2 01/12] remote: validate --force-with-lease <refname> argument
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 5, 2026, 23:03 UTC
- Message-ID
- <xmqqcxsiq3tg.fsf@gitster.g>
- In-Reply-To
- <20261014031347.50433-2-jon@jonsimons.org>
Jon Simons <jon@jonsimons.org> writes:
Show 7 quoted lines
> Use check_refname_format() to validate the <refname> component of > 'git push --force-with-lease=<refname>[:<expect>]'. > > apply_push_cas() will silently ignore a lease entry that does not match > any remote ref. And today "./refs/heads/main" will happen to be matched > with "refs/heads/main" due to refname_match() usage of mkpath(), whose > cleanup_path() strips leading "./".
Technically this may be a regression, but hopefully nobody would be insane enough to have used such a refname.
> An upcoming commit removes mkpath() from refname_match(), after which > there is no unintentional match in this situation, so that the lease > is ignored instead of applied. Reject an invalid refname now to make > this situation fail fast both before and after that change.
In other words, we would be introducing the same (technical) regression, so breaking this calling site is not a huge issue ;-)