Re: ref name troubles, was Re: [PATCH v2] Introduce %<branch> as shortcut to the tracked branch
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Mar 20, 2009, 00:44 UTC
- Message-ID
- <20090320004450.GY23521@spearce.org>
- In-Reply-To
- <20090320004029.GX23521@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 17 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Fri, 20 Mar 2009, Johannes Schindelin wrote:
> >
> > > Just try this:
> > >
> > > $ git checkout -b %helloworld
> >
> > It gets worse. Much worse.
> >
> > Try this (triggered by a comment by Ilari on IRC):
> >
> > $ git checkout -b '@{1}'
> >
> > That _works_! WTH?
>
> '@' is not reserved. Neither is '{' or '}'. Neither is
> the combination.In hindsight, I wish we had reserved all of the "fun" characters like !@#$%^&*():;~'"\ and prevented them from ever appearing in a ref name.
Instead only what check_ref_format() in refs.c ll.694 tells is is reserved:
671 /* 672 * Make sure "ref" is something reasonable to have under ".git/refs/"; 673 * We do not like it if: 674 * 675 * - any path component of it begins with ".", or 676 * - it has double dots "..", or 677 * - it has ASCII control character, "~", "^", ":" or SP, anywhere, or 678 * - it ends with a "/". 679 */
Heh. At least : and SP are reserved.
Use BEL for your %helloworld hack. It'll be fun to type. :-)
-- Shawn.