{"thread":{"id":"52973","subject":"[Feature request] Give non-unique names to commits for grouping","startedAt":"2020-03-10T23:16:25Z","lastAt":"2020-03-11T20:48:10Z","messageCount":7,"participants":["Christos Pappas","Konstantin Tokarev","Martin Fick","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"393048","messageId":"CAGa6KtSgGOLVjHdubwRW=Bvnjnp2PoP7jJ5_NxNWGFLrVYT9SA@mail.gmail.com","threadId":"52973","inReplyTo":null,"subject":"[Feature request] Give non-unique names to commits for grouping","fromName":"Christos Pappas","fromEmail":"chrispappas99@gmail.com","sentAt":"2020-03-10T23:16:09Z","receivedAt":"2020-03-10T23:16:25Z","isPatch":false,"sender":{"key":"chrispappas99@gmail.com","avatar":null},"body":"Dear Git users,\n\nI suggest that we should have the option to mark each commit with a\ncategory name, that is not necessarily unique (like 'tags') so we\ncould have commit groups.\nFor example we could:\ngit mark {commit_id} {name}\n\nThen we could give special functionality to some commands based on\nthose \"marks\".\nFor example if we had marked a few commits with the name 'fix_typo'\ngit log --mark fix_typo. Show all the commits marked with 'fix_typo'\ngit blame --mark fix_typo Run git blame but ignore commits with 'fix_typo'\n\n\nChristos\n"},{"id":"393049","messageId":"6552181583882319@iva1-398527a32f9a.qloud-c.yandex.net","threadId":"52973","inReplyTo":"CAGa6KtSgGOLVjHdubwRW=Bvnjnp2PoP7jJ5_NxNWGFLrVYT9SA@mail.gmail.com","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Konstantin Tokarev","fromEmail":"annulen@yandex.ru","sentAt":"2020-03-10T23:21:11Z","receivedAt":"2020-03-10T23:21:16Z","isPatch":false,"sender":{"key":"annulen@yandex.ru","avatar":null},"body":"\n\n11.03.2020, 02:16, \"Christos Pappas\" <chrispappas99@gmail.com>:\n> Dear Git users,\n>\n> I suggest that we should have the option to mark each commit with a\n> category name, that is not necessarily unique (like 'tags') so we\n> could have commit groups.\n> For example we could:\n> git mark {commit_id} {name}\n>\n> Then we could give special functionality to some commands based on\n> those \"marks\".\n> For example if we had marked a few commits with the name 'fix_typo'\n> git log --mark fix_typo. Show all the commits marked with 'fix_typo'\n> git blame --mark fix_typo Run git blame but ignore commits with 'fix_typo'\n\nWhy not use git log --grep? It can give better results if someone accidentally\nforgets to use mark properly, but mentions keyword in the topic.\n\nThat said, it would be great if there was an easy way to use git log --grep\nwith commit topics only (i.e., search only in the first line)\n\n-- \nRegards,\nKonstantin\n\n"},{"id":"393072","messageId":"2001043.V3P9HlvaID@mfick-lnx","threadId":"52973","inReplyTo":"CAGa6KtSgGOLVjHdubwRW=Bvnjnp2PoP7jJ5_NxNWGFLrVYT9SA@mail.gmail.com","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Martin Fick","fromEmail":"mfick@codeaurora.org","sentAt":"2020-03-11T16:00:03Z","receivedAt":"2020-03-11T16:00:19Z","isPatch":false,"sender":{"key":"mfick@codeaurora.org","avatar":null},"body":"On Wednesday, March 11, 2020 1:16:09 AM MDT Christos Pappas wrote:\n> I suggest that we should have the option to mark each commit with a\n> category name, that is not necessarily unique (like 'tags') so we\n> could have commit groups.\n> For example we could:\n> git mark {commit_id} {name}\n> \n> Then we could give special functionality to some commands based on\n> those \"marks\".\n> For example if we had marked a few commits with the name 'fix_typo'\n> git log --mark fix_typo. Show all the commits marked with 'fix_typo'\n> git blame --mark fix_typo Run git blame but ignore commits with 'fix_typo'\n\nPerhaps git notes could be used to do something like this?\n\n-Martin\n\n-- \nThe Qualcomm Innovation Center, Inc. is a member of Code \nAurora Forum, hosted by The Linux Foundation\n"},{"id":"393067","messageId":"CAGa6KtQ2dQWPWxbk2MH8QJxemM8QD_O=B3aYzsP5AH-sN-7PSw@mail.gmail.com","threadId":"52973","inReplyTo":"2001043.V3P9HlvaID@mfick-lnx","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Christos Pappas","fromEmail":"chrispappas99@gmail.com","sentAt":"2020-03-11T18:56:44Z","receivedAt":"2020-03-11T18:56:56Z","isPatch":false,"sender":{"key":"chrispappas99@gmail.com","avatar":null},"body":"Thank you for your answers.\n\nFrom what I can deduce, both of your suggestions require that the\ncommit messages(or notes) must have some special text for which we can\nsearch for, which is hacky and would be different on every repository.\n\nWhat I am suggesting is something like, labels on GitHub, hashtags on\nSocial-Media, or Tags in News sites. It's a well known concept so it\nwill be easy to understand and use.\n\nWe could initially create the concept of marks/labels/{another name}\n('tags' is already in use by another git command) and then\nincrementally enhance the git commands to use this functionality (like\nthe example I gave above, with git blame).\n\n\nΣτις Τετ, 11 Μαρ 2020 στις 6:00 μ.μ., ο/η Martin Fick\n<mfick@codeaurora.org> έγραψε:\n>\n> On Wednesday, March 11, 2020 1:16:09 AM MDT Christos Pappas wrote:\n> > I suggest that we should have the option to mark each commit with a\n> > category name, that is not necessarily unique (like 'tags') so we\n> > could have commit groups.\n> > For example we could:\n> > git mark {commit_id} {name}\n> >\n> > Then we could give special functionality to some commands based on\n> > those \"marks\".\n> > For example if we had marked a few commits with the name 'fix_typo'\n> > git log --mark fix_typo. Show all the commits marked with 'fix_typo'\n> > git blame --mark fix_typo Run git blame but ignore commits with 'fix_typo'\n>\n> Perhaps git notes could be used to do something like this?\n>\n> -Martin\n>\n> --\n> The Qualcomm Innovation Center, Inc. is a member of Code\n> Aurora Forum, hosted by The Linux Foundation\n"},{"id":"393087","messageId":"12099923.Cjvj2aPIT9@mfick-lnx","threadId":"52973","inReplyTo":"CAGa6KtQ2dQWPWxbk2MH8QJxemM8QD_O=B3aYzsP5AH-sN-7PSw@mail.gmail.com","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Martin Fick","fromEmail":"mfick@codeaurora.org","sentAt":"2020-03-11T19:31:41Z","receivedAt":"2020-03-11T19:31:47Z","isPatch":false,"sender":{"key":"mfick@codeaurora.org","avatar":null},"body":"On Wednesday, March 11, 2020 8:56:44 PM MDT Christos Pappas wrote:\n> Thank you for your answers.\n\nFYI: the list preference is inline instead of top-posting.\n \n> From what I can deduce, both of your suggestions require that the\n> commit messages(or notes) must have some special text for which we can\n> search for, which is hacky and would be different on every repository.\n\nBy \"different\", do you mean the mechanism, or the content of the \"hashtag\" \nitself? I would imagine that you would expect the hashtags to be different,\nand that you are concerned that they might be stored differently on each\nsite, maybe on one site as a note like\n\n hashtag: awesome\n\nand on another:\n\n label: awesome\n\nIs that correct?\n\nIf so, then it seems like a reasonable suggestion that some tooling be built \nto potentially enforce something like that using git notes and/or commit \nmessages?\n\n> What I am suggesting is something like, labels on GitHub, hashtags on\n> Social-Media, or Tags in News sites. It's a well known concept so it\n> will be easy to understand and use.\n> \n> We could initially create the concept of marks/labels/{another name}\n> ('tags' is already in use by another git command) and then\n> incrementally enhance the git commands to use this functionality (like\n> the example I gave above, with git blame).\n\nRight, maybe git notes is just the storage mechanism for such a feature?\n\n-Martin\n\n-- \nThe Qualcomm Innovation Center, Inc. is a member of Code \nAurora Forum, hosted by The Linux Foundation\n"},{"id":"393089","messageId":"xmqqeetyhd4x.fsf@gitster.c.googlers.com","threadId":"52973","inReplyTo":"CAGa6KtQ2dQWPWxbk2MH8QJxemM8QD_O=B3aYzsP5AH-sN-7PSw@mail.gmail.com","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-11T20:04:14Z","receivedAt":"2020-03-11T20:04:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christos Pappas <chrispappas99@gmail.com> writes:\n\n> Thank you for your answers.\n>\n> From what I can deduce, both of your suggestions require that the\n> commit messages(or notes) must have some special text for which we can\n> search for, which is hacky and would be different on every repository.\n>\n> What I am suggesting is something like, labels on GitHub, hashtags on\n> Social-Media, or Tags in News sites. It's a well known concept so it\n> will be easy to understand and use.\n\nBy \"hashtags\", do you mean #hashtags, i.e. you must add some special\ntext for which you can search for?  That does sound just as hacky as\nany other embedded text in the messages of commit objects.\n\nOne large downside of embedding text (or #hashtags) in the message\nof a commit object is that you need to plan ahead and know what\ngroup the commit belongs to before you make it, but in general, it\nis unreasonable to expect perfect foresight.  Often you do not know\nwhat group the commit belongs to (e.g. you may want to label the set\nof commits that broke the latest release for feature 'frotz' with\nhashtag \"#broke-frotz\", but most likely you didn't know you were\nbreaking the feature when you were creating these commits).  Adding\nthese offending commit objects some comments in the form of notes\nobjects can be done retroactively, and as long as the set of\n\"tag-worthy\" commits is minority among all commits, grepping for\n\"#hashtag\" in the notes to find the notes that contain the tags you\nwanted should be cheaper than \"git log --grep\" which must read all\nthe commits in the history.\n\nAnother way may be \"git notes --ref broke-frotz add X -m . X\" (and\nsimilarly for Y and Z that also belong to \"#broke-frotz\" set of\ncommits) to mark them with an almost empty note in refs/notes/broke-frotz\nhierarchy.  Then \"git notes --ref broke-frotz list\" should be able\nto list these commits that have any notes in refs/notes/broke-frotz\nand there is no need for grepping.  Of course you can make it richer\nby describing why each of X, Y, and Z are in the \"broke-frotz\" set\nwhen you give the notes text to them.\n\n\n\n"},{"id":"393094","messageId":"CAGa6KtTRv1UZcVAWbwUR56wjeK2YE1NqyLe-yT3MrGC8sUYCvw@mail.gmail.com","threadId":"52973","inReplyTo":"12099923.Cjvj2aPIT9@mfick-lnx","subject":"Re: [Feature request] Give non-unique names to commits for grouping","fromName":"Christos Pappas","fromEmail":"chrispappas99@gmail.com","sentAt":"2020-03-11T20:47:56Z","receivedAt":"2020-03-11T20:48:10Z","isPatch":false,"sender":{"key":"chrispappas99@gmail.com","avatar":null},"body":"> By \"different\", do you mean the mechanism, or the content of the \"hashtag\"\n> itself? I would imagine that you would expect the hashtags to be different,\n> and that you are concerned that they might be stored differently on each\n> site, maybe on one site as a note like\n>\n>  hashtag: awesome\n>\n> and on another:\n>\n>  label: awesome\n>\n> Is that correct?\n>\n> If so, then it seems like a reasonable suggestion that some tooling be built\n> to potentially enforce something like that using git notes and/or commit\n> messages?\n\nYes, I think that every project would end up having a different convention.\n\n> Right, maybe git notes is just the storage mechanism for such a feature?\n\nMaybe some code could be shared behind the scenes(I don't know the\ncode architecture), but the interface should be different.\n\nI would expect a commit log to look like this:\n\ncommit {commit_hash} (HEAD -> master, tag: maybe_a_tag_here, labels:\nbug_fix front_end, origin/master, origin/HEAD)\nAuthor: ...\nDate: ...\n\nCommit Message\n\nThis also requires at least one command to create a label (git label\ncreate {name}), and a different command to assign one of the available\nlabels (git label assign {label} {commit}), to avoid mistakes (The\nlevenshtein algorithm could also be used when the user makes a typo\nand tries to assign a label that doesn't exist)\n\nΣτις Τετ, 11 Μαρ 2020 στις 9:31 μ.μ., ο/η Martin Fick\n<mfick@codeaurora.org> έγραψε:\n>\n> On Wednesday, March 11, 2020 8:56:44 PM MDT Christos Pappas wrote:\n> > Thank you for your answers.\n>\n> FYI: the list preference is inline instead of top-posting.\n>\n> > From what I can deduce, both of your suggestions require that the\n> > commit messages(or notes) must have some special text for which we can\n> > search for, which is hacky and would be different on every repository.\n>\n> By \"different\", do you mean the mechanism, or the content of the \"hashtag\"\n> itself? I would imagine that you would expect the hashtags to be different,\n> and that you are concerned that they might be stored differently on each\n> site, maybe on one site as a note like\n>\n>  hashtag: awesome\n>\n> and on another:\n>\n>  label: awesome\n>\n> Is that correct?\n>\n> If so, then it seems like a reasonable suggestion that some tooling be built\n> to potentially enforce something like that using git notes and/or commit\n> messages?\n>\n> > What I am suggesting is something like, labels on GitHub, hashtags on\n> > Social-Media, or Tags in News sites. It's a well known concept so it\n> > will be easy to understand and use.\n> >\n> > We could initially create the concept of marks/labels/{another name}\n> > ('tags' is already in use by another git command) and then\n> > incrementally enhance the git commands to use this functionality (like\n> > the example I gave above, with git blame).\n>\n> Right, maybe git notes is just the storage mechanism for such a feature?\n>\n> -Martin\n>\n> --\n> The Qualcomm Innovation Center, Inc. is a member of Code\n> Aurora Forum, hosted by The Linux Foundation\n"}]}