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

Re: branch description as a note?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2024, 01:52 UTC
Message-ID
<xmqqzfl1fz17.fsf@gitster.g>
In-Reply-To
<ldbhbymjanp5xg4suatp2bgbnk3etkgxqivytpqzyqkmsiuotk@hnro3pu2zqtj>
Justin Tobler <jltobler@gmail.com> writes:
Show 7 quoted lines
> One problem I see with notes is they all live in a single notes tree and
> are associated with individual commits. Therefore, I'm not quite sure
> how a specific note could be correlated with a branch without having a
> separate notes tree for each branch. Maybe the notes mechanism could be
> extended to also support storing notes associated directly with a
> reference in its tree? That might allow for notes to follow a reference
> as it gets updated.

The "in a single notes tree" part is easily surmountable by having more than one (see "git notes --ref=..." option) and that indeed is how I maintain the mapping from each commit to the message-ID the commit comes from.

But you are absolutely correct to point out that notes are attached to individual commits, and it becomes unwieldy once you start to have more than one commit on the branch. You can attempt to work it around by enforcing a convention, like "the commit at the tip of the branch has its descriptions", but then "git commit" that advances the branch by one commit needs to move the notes, "git reset" to rewind and "git branch" to repoint would need to transplant, but then there needs ways to differenciate a forking (you are creating a new branch from the tip of an existing branch, you do not want to copy the old branch's description) and repointing. It easily lead to UI nightmare.

Abusing notes tree by storing branch name in a blob and taking the blob object name as the key in a notes tree will absolutely not work. The names of branches are ephemeral and local (what I call the ps/build branch may be called junio/ps/build by Patrick, and both names are valid in the scope around these names), so using such a local name as a key would make it even harder to share such notes tree (not that "git notes merge" is a great end user experience to begin with).

Previous: Bence FerdinandyNext: Bence Ferdinandy
Message 12 of 16 in “branch description as a note?”
  1. Bence FerdinandyDec 11, 2024
  2. Junio C HamanoDec 11, 2024
  3. Konstantin RyabitsevDec 11, 2024
  4. Bence FerdinandyDec 11, 2024
  5. Junio C HamanoDec 12, 2024
  6. Konstantin RyabitsevDec 12, 2024
  7. Bence FerdinandyDec 11, 2024
  8. Junio C HamanoDec 12, 2024
  9. Bence FerdinandyDec 12, 2024
  10. Justin ToblerDec 11, 2024
  11. Bence FerdinandyDec 11, 2024
  12. Junio C HamanoDec 12, 2024
  13. Bence FerdinandyDec 12, 2024
  14. Kristoffer HaugsbakkDec 11, 2024
  15. Kristoffer HaugsbakkDec 11, 2024
  16. Oswald BuddenhagenDec 12, 2024

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.