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

Re: [PATCH v4 4/4] notes: teach git-notes about notes.<ref>.merge option

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2015, 22:41 UTC
Message-ID
<xmqqmvxwjfjb.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CA+P7+xp0zhqM4CHmFpKuPyNMTx3DBxiLSOsiwz=byrfTEDj3sA@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> writes:
> I spoke to soon. We have an "init_notes_check" function which shows
> that it does refuse to merge outside of refs/notes/* It prevents all
> notes operations outside of refs/notes

OK. Then it is OK to limit notes.<ref>.mergestrategy so that <ref> refers to what comes after refs/notes/, because we will not allow merging to happen outside the hierarchy.

If you are planning to break that promise, however, <ref> must be always spelled fully (i.e. with refs/notes/ prefix for those inside the hierarchy) to avoid ambiguity. Otherwise it will be hard to interpret a configuration that does something like this (note that these could come from multiple places, e.g. $HOME/.gitconfig and $GIT_DIR/config):

    [notes "commits"]
        mergestrategy = concatenate
    [notes "notes/commits"]
        mergestrategy = cat_sort_uniq
    [notes "refs/notes/commits"]
        mergestrategy = overwrite

The three entries in the above example obviously are all meant to refer to the same refs/notes/commits notes tree, and the usual "last one wins" rule should apply. But with the recent git_config_get_*() interface, you cannot tell which one among them was given the last, overriding the previous entries.

Previous: Jacob KellerNext: Jacob Keller
Message 20 of 21 in “add notes strategy configuration options”
  1. 0/4 add notes strategy configuration optionsJacob Keller, Aug 11, 2015
  2. 1/4 notes: document cat_sort_uniq rewriteModeJacob Keller, Aug 11, 2015
  3. Johan HerlandAug 12, 2015
  4. 2/4 notes: add tests for --commit/--abort/--strategy exclusivityJacob Keller, Aug 11, 2015
  5. Johan HerlandAug 12, 2015
  6. 3/4 notes: add notes.merge option to select default strategyJacob Keller, Aug 11, 2015
  7. Johan HerlandAug 12, 2015
  8. 4/4 notes: teach git-notes about notes.<ref>.merge optionJacob Keller, Aug 11, 2015
  9. Eric SunshineAug 12, 2015
  10. Johan HerlandAug 12, 2015
  11. Junio C HamanoAug 12, 2015
  12. Jacob KellerAug 12, 2015
  13. Junio C HamanoAug 12, 2015
  14. Jacob KellerAug 12, 2015
  15. Jacob KellerAug 12, 2015
  16. Johan HerlandAug 12, 2015
  17. Johan HerlandAug 12, 2015
  18. Jacob KellerAug 12, 2015
  19. Jacob KellerAug 12, 2015
  20. Junio C HamanoAug 12, 2015
  21. Jacob KellerAug 12, 2015

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.