Re: [PATCH 07/18] builtin/notes.c: Split notes ref DWIMmery into a separate function
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 5, 2010, 15:50 UTC
- Message-ID
- <20101005155053.GH12797@burratino>
- In-Reply-To
- <1285719811-10871-8-git-send-email-johan@herland.net>
Johan Herland wrote:
Show 15 quoted lines
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -83,6 +83,16 @@ struct msg_arg {
> struct strbuf buf;
> };
>
> +static void expand_notes_ref(struct strbuf *sb)
> +{
> + if (!prefixcmp(sb->buf, "refs/notes/"))
> + return; /* we're happy */
> + else if (!prefixcmp(sb->buf, "notes/"))
> + strbuf_insert(sb, 0, "refs/", 5);
> + else
> + strbuf_insert(sb, 0, "refs/notes/", 11);
> +}Aside: I'm not sure this is the most convenient rule to use after all.
Example:
$ git log --notes-ref=charon/notes/full
fatal: unrecognized argument: --notes-ref=charon/notes/full
$ git log --show-notes=charon/notes/full
warning: notes ref refs/notes/charon/notes/full is invalid
...
$ git log --show-notes=remotes/charon/notes/full
warning: notes ref refs/notes/remotes/charon/notes/full is invalid
...
$ git log --show-notes=refs/remotes/charon/notes/full -1
commit 16461e8e5fc5b2dbe9176b9a8313c395e1e07304
Merge: c3e5a06 79bd09f
Author: Junio C Hamano <gitster@pobox.com>
Date: Thu Sep 30 16:02:27 2010 -0700
Merge branch 'il/remote-fd-ext' into pu
* il/remote-fd-ext:
fixup! git-remote-fd
Notes (remotes/charon/notes/full):
Pu-Overview:
What's cooking in git.git (Sep 2010, #07; Wed, 29)
$And now that I think of it, the revision args parser uses its own code for this...
Regardless, this patch is a step in the right direction imho.