Thread (1 message) 1 message, 1 author, 2020-03-11

Re: [Feature request] Give non-unique names to commits for grouping

From: Junio C Hamano <hidden>
Date: 2020-03-11 20:04:25

Christos Pappas [off-list ref] writes:
Thank you for your answers.

From what I can deduce, both of your suggestions require that the
commit messages(or notes) must have some special text for which we can
search for, which is hacky and would be different on every repository.

What I am suggesting is something like, labels on GitHub, hashtags on
Social-Media, or Tags in News sites. It's a well known concept so it
will be easy to understand and use.
By "hashtags", do you mean #hashtags, i.e. you must add some special
text for which you can search for?  That does sound just as hacky as
any other embedded text in the messages of commit objects.

One large downside of embedding text (or #hashtags) in the message
of a commit object is that you need to plan ahead and know what
group the commit belongs to before you make it, but in general, it
is unreasonable to expect perfect foresight.  Often you do not know
what group the commit belongs to (e.g. you may want to label the set
of commits that broke the latest release for feature 'frotz' with
hashtag "#broke-frotz", but most likely you didn't know you were
breaking the feature when you were creating these commits).  Adding
these offending commit objects some comments in the form of notes
objects can be done retroactively, and as long as the set of
"tag-worthy" commits is minority among all commits, grepping for
"#hashtag" in the notes to find the notes that contain the tags you
wanted should be cheaper than "git log --grep" which must read all
the commits in the history.

Another way may be "git notes --ref broke-frotz add X -m . X" (and
similarly for Y and Z that also belong to "#broke-frotz" set of
commits) to mark them with an almost empty note in refs/notes/broke-frotz
hierarchy.  Then "git notes --ref broke-frotz list" should be able
to list these commits that have any notes in refs/notes/broke-frotz
and there is no need for grepping.  Of course you can make it richer
by describing why each of X, Y, and Z are in the "broke-frotz" set
when you give the notes text to them.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help