git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Remove restriction on notes ref base

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 2, 2010, 06:52 UTC
Message-ID
<20101102065208.GA4280@burratino>
In-Reply-To
<1288657003-17802-1-git-send-email-kroot@google.com>
(+cc: Johan, Thomas)
Kenny Root wrote:
Show 5 quoted lines
> 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.]
Show 42 quoted lines
> Signed-off-by: Kenny Root <kroot@google.com>
> ---
>  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/");
> -- 
Previous: Kenny RootNext: Johan Herland
Message 2 of 21 in “Remove restriction on notes ref base”
  1. Remove restriction on notes ref baseKenny Root, Nov 2, 2010
  2. Jonathan NiederNov 2, 2010
  3. Johan HerlandNov 2, 2010
  4. Shawn PearceNov 2, 2010
  5. Jeff KingNov 2, 2010
  6. Johan HerlandNov 2, 2010
  7. Junio C HamanoNov 2, 2010
  8. Johan HerlandNov 2, 2010
  9. Chris ForbesNov 2, 2010
  10. Jonathan NiederNov 3, 2010
  11. Junio C HamanoNov 3, 2010
  12. Sverre RabbelierNov 3, 2010
  13. Johan HerlandNov 4, 2010
  14. Sverre RabbelierNov 4, 2010
  15. Tag refspecs (was Re: [PATCH] Remove restriction on notes ref base)Marc Branchaud, Nov 4, 2010
  16. Johan HerlandNov 5, 2010
  17. Marc BranchaudNov 5, 2010
  18. Jeff KingNov 4, 2010
  19. Johan HerlandNov 5, 2010
  20. Jeff KingNov 5, 2010
  21. Jonathan NiederNov 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.