From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jens Lehmann <Jens.Lehmann@web.de>, git@vger.kernel.org
Subject: Re: [PATCH] disallow refs containing successive slashes
Date: Sun, 11 Oct 2009 19:31:15 -0500 [thread overview]
Message-ID: <20091012003115.GA5782@progeny.tock> (raw)
In-Reply-To: <7vbpkdwyo2.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> When the users make typoes (e.g. /foo//bar) you can accept the only sane
> correction (e.g. foo/bar) instead of rejecting, since the only thing the
> user can do after getting such a rejection is to correct it to that
> corrected name (e.g. foo/bar) himself and re-issue the command anyway.
> You can push the "hassle" down to the user, or you can fix the tool to
> remove the hassle from the user.
Yes, making check-ref-format stricter without changing its users to
massage their input would be a regression.
The problem Jens described is a git-gui bug. In lib/branch_delete.tcl,
line 57, the list of deletable branches is populated as follows:
foreach h [load_all_heads] {
if {$h ne $current_branch} {
$w_heads insert end $h
}
}
Since slashes coalesce, a user-supplied new branch name is not canonical
and checking "$h eq $current_branch" does not actually check if they are
the same branch. git-gui should be using the branch name as output by
"git check-ref-format --branch" after the branch is created.
But what about other scripts that assume each branch has only one
possible name? Maybe they could be forced to fix up the name early on
by making check-ref-format reject names with "//" in them and providing
a "git check-ref-format --print" to help.
Upside: scripts would complain loudly instead of failing subtly on input
with extra slashes if they forget to use "git check-ref-format --print"
when appropriate. Downside: users, including the 22 callers of
check_ref_format() in git, would have to be checked and probably changed
to avoid regressions.
Never having made that typo, I find it hard to consider such a change
worth the trouble, but it sounds doable.
Regards,
Jonathan
next prev parent reply other threads:[~2009-10-12 0:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-10 17:49 [PATCH] disallow refs containing successive slashes Jens Lehmann
2009-10-10 21:50 ` Junio C Hamano
2009-10-11 10:42 ` Jens Lehmann
2009-10-11 18:52 ` Junio C Hamano
2009-10-12 0:31 ` Jonathan Nieder [this message]
2009-10-12 2:47 ` Nanako Shiraishi
2009-10-12 5:25 ` [PATCH/RFC 0/4] plumbing to help fix git-gui Jonathan Nieder
2009-10-12 5:27 ` [PATCH 1/4] Add tests for git check-ref-format Jonathan Nieder
2009-10-12 5:28 ` [PATCH 2/4] Documentation: describe check-ref-format --branch Jonathan Nieder
2009-10-12 5:31 ` [PATCH/RFC 3/4] git check-ref-format --print Jonathan Nieder
2009-10-12 14:39 ` Shawn O. Pearce
2009-10-12 21:06 ` Junio C Hamano
2009-10-12 23:26 ` Shawn O. Pearce
2009-10-12 23:36 ` Junio C Hamano
2009-10-13 4:49 ` Jonathan Nieder
2009-10-12 5:33 ` [PATCH/RFC 4/4] check-ref-format: simplify --print implementation Jonathan Nieder
2009-10-12 5:45 ` [PATCH/RFC 0/4] plumbing to help fix git-gui Jonathan Nieder
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091012003115.GA5782@progeny.tock \
--to=jrnieder@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
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 NNTP newsgroup(s).