{"thread":{"id":"16251","subject":"Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","startedAt":"2008-11-10T17:37:20Z","lastAt":"2008-11-11T00:31:36Z","messageCount":10,"participants":["Thomas Harning","Jeff King","Johannes Schindelin","Johan Herland","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"95346","messageId":"6A0F154C-B9FE-4770-BF70-82A5BEBF907C@gmail.com","threadId":"16251","inReplyTo":null,"subject":"Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Thomas Harning","fromEmail":"harningt@gmail.com","sentAt":"2008-11-10T17:37:20Z","receivedAt":"2008-11-10T17:37:20Z","isPatch":false,"sender":{"key":"harningt@gmail.com","avatar":"https://gravatar.com/avatar/a79ddd43da8c8f1f899cd75b7b95cc5f3b2ba5643400468988b1a12c86b75d08?d=mp&s=160"},"body":"Just wondering, has there been any looking into whether the git-notes  \nconcept can track rebases?\n\n\nReading over what git-notes is leads me to think it could be a good  \nmechanism for the distributed bug-tracking idea I had some time ago.\nThe only gotcha I see is that there would have to be some reverse  \nmapping / fast lookup to track the commit objects that given notes are  \nattached to.... and to facilitate individual assignment... notes  \napplied to notes.\n\n\nExample structure:\n\nCommits A B C D\nNotes   BUG\nNotes\tnA nC    == bug notes\n\nA <- nA\n|\\\nB C <- nC\n|/\nD\n\n\nnA <- BUG\nnB <- BUG\n\n\nOperations for bug-tracking:\n\n1) List all 'BUG'-type items that would refer to individual notes\n2) List 'BUG' items reachable from a point\n    Perhaps with criterion that a certain 'bug note' attribute is not  \nset...\n    or that a 'BUG_CLOSED' note is not attached to the given 'bug note'\n\n\n... this seems to be somewhat of an extreme abuse of the notes  \nsystem... but I could imagine it may have uses outside...\n"},{"id":"95359","messageId":"20081110191134.GA3329@sigill.intra.peff.net","threadId":"16251","inReplyTo":"6A0F154C-B9FE-4770-BF70-82A5BEBF907C@gmail.com","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-11-10T19:11:35Z","receivedAt":"2008-11-10T19:11:35Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 10, 2008 at 12:37:20PM -0500, Thomas Harning wrote:\n\n> Just wondering, has there been any looking into whether the git-notes  \n> concept can track rebases?\n\nNot that I know of, but then again, I'm not sure exactly what you mean\nby \"track rebases\".\n\n> Reading over what git-notes is leads me to think it could be a good  \n> mechanism for the distributed bug-tracking idea I had some time ago.\n> The only gotcha I see is that there would have to be some reverse mapping \n> / fast lookup to track the commit objects that given notes are attached \n> to.... and to facilitate individual assignment... notes applied to notes.\n\nYou can really think of the notes facility as a way of mapping\nSHA1 -> SHA1. So the oft-discussed concept of \"attach some text\nto this commit\" would be a commit sha1 mapping to a blob that\ncontains the text.  You have the commit, and you want to look up\nthe attached text.\n\nHow fast you can do a reverse lookup depends on what you are given. If\nyou are saying \"I want to look through the list of all notes, and see\nwhich commits they are attached to\" that is quick. You are iterating\nthrough the mapping, so you just look at the left hand side.\n\nBut if you are given a SHA-1 (say, of a blob with some text) and\nask \"which commits map to this blob\", then you will have to\nlinearly search through the mapping. Which really _isn't_ that\npainful, if you are doing one such search per user request, but\ncan be slow if you want to do it for 10,000 notes.\n\nAnd in the latter case, I would suggest simply building a reverse\nmapping. Which you _could_ make as a parallel notes namespace,\nbut then you have to keep the two in sync. I would suggest\ninstead simply building a hash table on the fly for the reverse\nmapping (which is basically what the forward-lookup does, anyway,\nsince our tree lookup is necessarily linear).\n\nAs far as attaching notes to notes, again it depends what you\nmean. If you mean \"map a blob SHA-1 to another blob SHA-1\", then\nthat is simple. E.g., if you have some commit mapping to the text\nnote \"foo\", then you can map another note \"bar\" onto \"foo\".\n\nBut if you want to put a note onto the actual mapping, that is a\nbit different. Since notes are a commit history of trees, I would\nthink you would simply make a new commit, and put your note into\nthe commit message. And if you need to do so after the fact, then\nof course it is just putting a note onto the commit in the notes\nhistory.\n\nBut bear in mind that the whole point of notes is annotating\ncommits after the fact, since commits must remain immutable. So\nmight it not be simpler to just update the note itself, with the\nnew information, rather than creating a note of a note?\n\n> Operations for bug-tracking:\n>\n> 1) List all 'BUG'-type items that would refer to individual notes\n> 2) List 'BUG' items reachable from a point\n>    Perhaps with criterion that a certain 'bug note' attribute is not  \n> set...\n>    or that a 'BUG_CLOSED' note is not attached to the given 'bug note'\n\nI'm not sure that doing bug tracking in this way makes sense with\nnotes. If notes are a mapping of a commit sha-1 to a blob, then\nhow do I have a commit with _two_ bugs? I think a bug database\nshould be indexed by bug id, not by commit id which has the bug.\n\n-Peff\n"},{"id":"95367","messageId":"20081110195120.GA3688@sigill.intra.peff.net","threadId":"16251","inReplyTo":"alpine.DEB.1.00.0811102049460.30769@pacific.mpi-cbg.de","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-11-10T19:51:20Z","receivedAt":"2008-11-10T19:51:20Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 10, 2008 at 08:51:50PM +0100, Johannes Schindelin wrote:\n\n> > Not that I know of, but then again, I'm not sure exactly what you mean \n> > by \"track rebases\".\n> \n> I guess he means that you could have something like this\n> \n> \trebased from <SHA-1>\n> \n> in the notes for any given commit, so that _if_ you have the commit, e.g. \n> gitk could show that connection (maybe dashed in the graphical history \n> display, and as a \"Rebased from:\" link).\n\nYou don't really need \"notes\" for that, though, since you can put that\ninformation into the commit message (or headers) if you choose. I guess\nit has the advantage of not polluting the commit for others.\n\n-Peff\n"},{"id":"95364","messageId":"alpine.DEB.1.00.0811102049460.30769@pacific.mpi-cbg.de","threadId":"16251","inReplyTo":"20081110191134.GA3329@sigill.intra.peff.net","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-10T19:51:50Z","receivedAt":"2008-11-10T19:51:50Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Nov 2008, Jeff King wrote:\n\n> On Mon, Nov 10, 2008 at 12:37:20PM -0500, Thomas Harning wrote:\n> \n> > Just wondering, has there been any looking into whether the git-notes \n> > concept can track rebases?\n> \n> Not that I know of, but then again, I'm not sure exactly what you mean \n> by \"track rebases\".\n\nI guess he means that you could have something like this\n\n\trebased from <SHA-1>\n\nin the notes for any given commit, so that _if_ you have the commit, e.g. \ngitk could show that connection (maybe dashed in the graphical history \ndisplay, and as a \"Rebased from:\" link).\n\nCiao,\nDscho\n"},{"id":"95369","messageId":"200811102101.15285.johan@herland.net","threadId":"16251","inReplyTo":"20081110195120.GA3688@sigill.intra.peff.net","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-11-10T20:01:15Z","receivedAt":"2008-11-10T20:01:15Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 10 November 2008, Jeff King wrote:\n> On Mon, Nov 10, 2008 at 08:51:50PM +0100, Johannes Schindelin wrote:\n> > > Not that I know of, but then again, I'm not sure exactly what you\n> > > mean by \"track rebases\".\n> >\n> > I guess he means that you could have something like this\n> >\n> > \trebased from <SHA-1>\n> >\n> > in the notes for any given commit, so that _if_ you have the commit,\n> > e.g. gitk could show that connection (maybe dashed in the graphical\n> > history display, and as a \"Rebased from:\" link).\n>\n> You don't really need \"notes\" for that, though, since you can put that\n> information into the commit message (or headers) if you choose. I guess\n> it has the advantage of not polluting the commit for others.\n\nDoes it make sense to teach \"git rebase\" the -x option from \"git \ncherry-pick\"? As with \"git cherry-pick -x\" it only makes sense to use it if \nyour rebasing from a public branch.\n\n\nHave fun!\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"95374","messageId":"74EBEC20-FC39-444E-8B96-31E5B36894B8@gmail.com","threadId":"16251","inReplyTo":"alpine.DEB.1.00.0811102049460.30769@pacific.mpi-cbg.de","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Thomas Harning","fromEmail":"harningt@gmail.com","sentAt":"2008-11-10T20:26:52Z","receivedAt":"2008-11-10T20:26:52Z","isPatch":false,"sender":{"key":"harningt@gmail.com","avatar":"https://gravatar.com/avatar/a79ddd43da8c8f1f899cd75b7b95cc5f3b2ba5643400468988b1a12c86b75d08?d=mp&s=160"},"body":"\nOn Nov 10, 2008, at 2:51 PM, Johannes Schindelin wrote:\n\n> Hi,\n>\n> On Mon, 10 Nov 2008, Jeff King wrote:\n>\n>> On Mon, Nov 10, 2008 at 12:37:20PM -0500, Thomas Harning wrote:\n>>\n>>> Just wondering, has there been any looking into whether the git- \n>>> notes\n>>> concept can track rebases?\n>>\n>> Not that I know of, but then again, I'm not sure exactly what you  \n>> mean\n>> by \"track rebases\".\n>\n> I guess he means that you could have something like this\n>\n> \trebased from <SHA-1>\n>\n> in the notes for any given commit, so that _if_ you have the commit,  \n> e.g.\n> gitk could show that connection (maybe dashed in the graphical history\n> display, and as a \"Rebased from:\" link).\nWhat I intended is that if notes are attached to 'A',  A` (after a  \nrebase) will have the exact same note.\n"},{"id":"95376","messageId":"20081110203437.GW24201@genesis.frugalware.org","threadId":"16251","inReplyTo":"200811102101.15285.johan@herland.net","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-11-10T20:34:37Z","receivedAt":"2008-11-10T20:34:37Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Mon, Nov 10, 2008 at 09:01:15PM +0100, Johan Herland <johan@herland.net> wrote:\n> Does it make sense to teach \"git rebase\" the -x option from \"git \n> cherry-pick\"? As with \"git cherry-pick -x\" it only makes sense to use it if \n> your rebasing from a public branch.\n\nBut rebasing a public branch is always something we try to prevent. So\nbasically -x would be useful only in case the user does what we asked\nnot to do. ;-)\n"},{"id":"95377","messageId":"alpine.DEB.1.00.0811102147340.30769@pacific.mpi-cbg.de","threadId":"16251","inReplyTo":"20081110195120.GA3688@sigill.intra.peff.net","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-10T20:48:17Z","receivedAt":"2008-11-10T20:48:17Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Nov 2008, Jeff King wrote:\n\n> On Mon, Nov 10, 2008 at 08:51:50PM +0100, Johannes Schindelin wrote:\n> \n> > > Not that I know of, but then again, I'm not sure exactly what you \n> > > mean by \"track rebases\".\n> > \n> > I guess he means that you could have something like this\n> > \n> > \trebased from <SHA-1>\n> > \n> > in the notes for any given commit, so that _if_ you have the commit, \n> > e.g. gitk could show that connection (maybe dashed in the graphical \n> > history display, and as a \"Rebased from:\" link).\n> \n> You don't really need \"notes\" for that, though, since you can put that \n> information into the commit message (or headers) if you choose. I guess \n> it has the advantage of not polluting the commit for others.\n\nExactly.  And it would have the nice side effect that you could use a \nnotes ref \"rebases\", and just not show it when you are not interested in \nlooking at rebases.\n\nCiao,\nDscho\n"},{"id":"95394","messageId":"200811102251.37044.johan@herland.net","threadId":"16251","inReplyTo":"20081110203437.GW24201@genesis.frugalware.org","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-11-10T21:51:36Z","receivedAt":"2008-11-10T21:51:36Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 10 November 2008, Miklos Vajna wrote:\n> On Mon, Nov 10, 2008 at 09:01:15PM +0100, Johan Herland \n<johan@herland.net> wrote:\n> > Does it make sense to teach \"git rebase\" the -x option from \"git\n> > cherry-pick\"? As with \"git cherry-pick -x\" it only makes sense to use\n> > it if your rebasing from a public branch.\n>\n> But rebasing a public branch is always something we try to prevent. So\n> basically -x would be useful only in case the user does what we asked\n> not to do. ;-)\n\nSorry, I wasn't clear enough: I am talking about a copy-rebase, that is, the \noriginal public branch is unchanged, but you copy patches from it by making \na local temporary branch that starts out in the same place and then \nrebasing it onto the other public branch where your want the patches to end \nup (followed by fast-forwarding the target branch and removing the temp \nbranch). This is basically identical to cherry-picking a range of commits, \nbut since \"git cherry-pick\" does not support cherry-picking a range of \ncommits, this is the only alternative, AFAICS.\n\nHowever, it would probably be a better solution to make \"git cherry-pick\" \nwork on a commit range... (cf. the ongoing \"multiple-commit cherry-pick\" \nthread)\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"95420","messageId":"20081111003136.GA26481@coredump.intra.peff.net","threadId":"16251","inReplyTo":"74EBEC20-FC39-444E-8B96-31E5B36894B8@gmail.com","subject":"Re: Git Notes - Track rebase/etc + reverse-lookup for bugs ideas","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-11-11T00:31:36Z","receivedAt":"2008-11-11T00:31:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 10, 2008 at 03:26:52PM -0500, Thomas Harning wrote:\n\n> What I intended is that if notes are attached to 'A',  A` (after a  \n> rebase) will have the exact same note.\n\nI think that may have been brought up at the GitTogether. It would be\nvery easy, when rebasing A to A', to copy any notes for A to A'\n(retroactively applying notes for A' to A (or vice versa) is much\nharder, since we don't maintain any mapping between the two).\n\n_But_ that is not necessarily a good idea in all cases, because your\nnotes may say certain things about A like \"I tested this on system X\".\nBut you _haven't_ tested A', and it might not pass your test. Leaving\naside editing the commits with \"rebase -i\", there might just be a bad\ninteraction with the commit you rebased onto.\n\nSo I think it would probably make sense to add a \"--copy-notes\" option\nto rebase for those times when the user knows it makes sense, but doing\nso by default is probably a mistake.\n\n-Peff\n"}]}