Re: [PATCH] Remove restriction on notes ref base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(+cc: Johan, Thomas)

Kenny Root wrote:

> Git notes were restricted to refs/notes/* in the command line utilities,
> but setting things like GIT_NOTES_REF to something outside of that
> structure would work.
> 
> This removes the restrictions on the git notes command line interface.

Could you explain what those restrictions are (perhaps through an
example in the form of a patch to the t/ subdirectory)?

Cc-ing some people more knowledgeable about notes than I am; maybe
they can give more information about what this notes.rewriteref
protection and other check are about.

Jonathan

[patch follows for their convenience.]
> Signed-off-by: Kenny Root <kroot@xxxxxxxxxx>
> ---
>  builtin/notes.c |   11 ++---------
>  1 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/builtin/notes.c b/builtin/notes.c
> index 6d07aac..9acce7b 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -343,11 +343,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
>  	} else if (!c->refs_from_env && !strcmp(k, "notes.rewriteref")) {
>  		/* note that a refs/ prefix is implied in the
>  		 * underlying for_each_glob_ref */
> -		if (!prefixcmp(v, "refs/notes/"))
> -			string_list_add_refs_by_glob(c->refs, v);
> -		else
> -			warning("Refusing to rewrite notes in %s"
> -				" (outside of refs/notes/)", v);
> +		string_list_add_refs_by_glob(c->refs, v);
>  		return 0;
>  	}
>  
> @@ -473,9 +469,6 @@ static struct notes_tree *init_notes_check(const char *subcommand)
>  	init_notes(NULL, NULL, NULL, 0);
>  	t = &default_notes_tree;
>  
> -	if (prefixcmp(t->ref, "refs/notes/"))
> -		die("Refusing to %s notes in %s (outside of refs/notes/)",
> -		    subcommand, t->ref);
>  	return t;
>  }
>  
> @@ -844,7 +837,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
>  
>  	if (override_notes_ref) {
>  		struct strbuf sb = STRBUF_INIT;
> -		if (!prefixcmp(override_notes_ref, "refs/notes/"))
> +		if (!prefixcmp(override_notes_ref, "refs/"))
>  			/* we're happy */;
>  		else if (!prefixcmp(override_notes_ref, "notes/"))
>  			strbuf_addstr(&sb, "refs/");
> -- 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]