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

Re: [PATCH] notes: accept any ref for merge

From
Jeff King <peff@peff.net>
Date
Sep 19, 2014, 09:39 UTC
Message-ID
<20140919093910.GA15891@peff.net>
In-Reply-To
<1411112385-33479-1-git-send-email-schacon@gmail.com>
On Fri, Sep 19, 2014 at 09:39:45AM +0200, Scott Chacon wrote:
Show 10 quoted lines
> Currently if you try to merge notes, the notes code ensures that the
> reference is under the 'refs/notes' namespace. In order to do any sort
> of collaborative workflow, this doesn't work well as you can't easily
> have local notes refs seperate from remote notes refs.
> 
> This patch changes the expand_notes_ref function to check for simply a
> leading refs/ instead of refs/notes to check if we're being passed an
> expanded notes reference. This would allow us to set up
> refs/remotes-notes or otherwise keep mergeable notes references outside
> of what would be contained in the notes push refspec.

I think this change affects not just "git notes merge", but all of the notes lookups (including just "git notes show"). However, I'd argue that's a good thing, as it allows more flexibility in note storage. The downside is that if you have a notes ref like "refs/notes/refs/heads/master", you can no longer refer to it as "refs/heads/master" (you have to use the fully qualified name to get the note). But:

  1. This makes the notes resolution a lot more like regular ref
     resolution (i.e., we now allow fully qualified refs, and you can
     store remote notes outside of refs/notes if you want to).
  2. There are already a bunch of names that have the same problem. You
     cannot refer to "refs/notes/notes/foo" as "notes/foo", nor
     "refs/notes/refs/notes/foo" as "refs/notes/foo". Yes, these are
     silly names, so is the example above.

So it's backwards incompatible with the current behavior, but I think in a good way.

> ---
>  notes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I think you need to adjust t3308 (and you should probably add a new test exercising your case; this is exactly the sort of thing that it's easy to accidentally regress later).

-Peff
Previous: Scott ChaconNext: Johan Herland
Message 2 of 9 in “notes: accept any ref for merge”
  1. notes: accept any ref for mergeScott Chacon, Sep 19, 2014
  2. Jeff KingSep 19, 2014
  3. Johan HerlandSep 19, 2014
  4. Junio C HamanoSep 19, 2014
  5. Johan HerlandSep 20, 2014
  6. Junio C HamanoSep 22, 2014
  7. Kyle J. McKayNov 22, 2014
  8. Jeff KingDec 4, 2014
  9. Junio C HamanoSep 19, 2014

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.