git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Justin Tobler <jltobler@gmail.com>
Cc: Bence Ferdinandy <bence@ferdinandy.com>,  git@vger.kernel.org
Subject: Re: branch description as a note?
Date: Thu, 12 Dec 2024 10:52:36 +0900	[thread overview]
Message-ID: <xmqqzfl1fz17.fsf@gitster.g> (raw)
In-Reply-To: <ldbhbymjanp5xg4suatp2bgbnk3etkgxqivytpqzyqkmsiuotk@hnro3pu2zqtj> (Justin Tobler's message of "Wed, 11 Dec 2024 11:34:10 -0600")

Justin Tobler <jltobler@gmail.com> writes:

> 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).


  parent reply	other threads:[~2024-12-12  1:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 10:39 branch description as a note? Bence Ferdinandy
2024-12-11 16:11 ` Junio C Hamano
2024-12-11 17:37   ` Konstantin Ryabitsev
2024-12-11 22:11     ` Bence Ferdinandy
2024-12-12  1:39     ` Junio C Hamano
2024-12-12  2:30       ` Konstantin Ryabitsev
2024-12-11 21:57   ` Bence Ferdinandy
2024-12-12  1:00     ` Junio C Hamano
2024-12-12 10:48       ` Bence Ferdinandy
2024-12-11 17:34 ` Justin Tobler
2024-12-11 22:02   ` Bence Ferdinandy
2024-12-12  1:52   ` Junio C Hamano [this message]
2024-12-12 10:57     ` Bence Ferdinandy
2024-12-11 20:13 ` Kristoffer Haugsbakk
2024-12-11 22:07   ` Kristoffer Haugsbakk
2024-12-12 10:48     ` Oswald Buddenhagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzfl1fz17.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=bence@ferdinandy.com \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).