Re: [PATCH v2] Bisect reset: remove bisect refs that may have been packed.
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Nov 15, 2007, 08:49 UTC
- Message-ID
- <20071115084934.GN14735@spearce.org>
- In-Reply-To
- <473C02F9.4020402@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 7 quoted lines
> Junio C Hamano schrieb: > >+ git for-each-ref --format='%(refname) %(objectname)' refs/bisect/\* > >refs/heads/bisect | > >+ while read ref hash > > If you also swap %(refname) and %(objectname), then this is also not prone > to whitespace in refnames. (Yes, I know, there shouldn't be such, but...)
What's this obsession with whitespace in refnames? Twice in like two days people are talking about whitespace in refnames.
WHITESPACE IS NOT PERMITTED IN REFNAMES.
Do we need to apply the following patch, to keep people from creating refs by hand with whitespace in them? Is this really that common?
git rev-parse HEAD >'.git/refs/heads/..i have spaces hah!'
diff --git a/refs.c b/refs.c index aff02cd..b95bf83 100644 --- a/refs.c +++ b/refs.c @@ -246,6 +246,7 @@ static struct ref_list *get_ref_dir(const char *base, struct ref_list *list) struct stat st; int flag; int namelen; + int check; if (de->d_name[0] == '.') continue; @@ -261,6 +262,9 @@ static struct ref_list *get_ref_dir(const char *base, struct ref_list *list) list = get_ref_dir(ref, list); continue; } + check = check_ref_format(ref); + if (check != 0 && check != -2) + continue; if (!resolve_ref(ref, sha1, 1, &flag)) { error("%s points nowhere!", ref); continue;
-- Shawn.