From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Ronnie Sahlberg <sahlberg@google.com>,
Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: check-ref-format: include refs/ in the argument or to strip it?
Date: Sat, 23 Aug 2014 01:46:46 -0400 [thread overview]
Message-ID: <20140823054646.GA18256@peff.net> (raw)
In-Reply-To: <20140822184515.GL20185@google.com>
On Fri, Aug 22, 2014 at 11:45:15AM -0700, Jonathan Nieder wrote:
> Junio C Hamano wrote:
>
> > implication of which is that the 'at least one slash'
> > rule was to expect things are 'refs/<anything>' so there will be at
> > least one. Even back then, that <anything> alone had at least one
> > slash (e.g. heads/master), but the intention was *never* that we
> > would forbid <anything> that does not have a slash by feeding
> > <anything> part alone to check-ref-format, i.e. things like
> > "refs/stash" were designed to be allowed.
>
> Now I'm more confused. Until 5f7b202a (2008-01-01), there was a
> comment
>
> if (level < 2)
> return -2; /* at least of form "heads/blah" */
>
> and that behavior has been preserved since the beginning.
>
> Why do most old callers pass a string that doesn't start with refs/
> (e.g., see the callers in 03feddd6, 2005-10-13)? Has the intent been
> to relax the requirement since then?
Yeah, this weird "do not allow refs/foo" behavior has continually
confused me. Coincidentally I just noticed a case today where
"pack-refs" treats "refs/foo" specially for no good reason:
http://thread.gmane.org/gmane.comp.version-control.git/255729
After much head scratching over the years, I am of the opinion that
nobody every really _meant_ to prevent "refs/foo", and that code
comments like the one you quote above were an attempt to document
existing buggy behavior that was really trying to differentiate "HEAD"
from "refs/*". That's just my opinion, though. :) I'd be happy if all of
the special-treatment of "refs/foo" went away and check_refname_format
always got the full ref.
-Peff
next prev parent reply other threads:[~2014-08-23 5:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <gerrit.1408574889668.Iac983fc86f7edd2a0543779d85973c57bf068ca4@code-review.googlesource.com>
[not found] ` <047d7b624d36142d46050131f336@google.com>
2014-08-22 15:41 ` check-ref-format: include refs/ in the argument or to strip it? Jonathan Nieder
2014-08-22 18:37 ` Junio C Hamano
2014-08-22 18:45 ` Jonathan Nieder
2014-08-23 5:46 ` Jeff King [this message]
2014-08-23 5:50 ` Junio C Hamano
2014-08-25 17:43 ` Ronnie Sahlberg
2014-08-25 18:26 ` Jonathan Nieder
2014-08-25 19:09 ` Jeff King
2014-08-27 20:53 ` Michael Haggerty
2014-08-25 19:01 ` Junio C Hamano
2014-08-23 2:59 ` 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=20140823054646.GA18256@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=mhagger@alum.mit.edu \
--cc=sahlberg@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.