{"thread":{"id":"24222","subject":"Patching bad commits","startedAt":"2010-06-28T22:03:38Z","lastAt":"2010-07-05T08:37:20Z","messageCount":4,"participants":["Michael Witten","Avery Pennarun","Sverre Rabbelier","Antriksh Pany"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144421","messageId":"4c291e41.4f1ee30a.3484.fffff729@mx.google.com","threadId":"24222","inReplyTo":null,"subject":"Patching bad commits","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2010-06-28T22:03:38Z","receivedAt":"2010-06-28T22:03:38Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Sometimes bisecting is less than useful because a number of commits\nfail to build.\n\nHow about implementing something SIMILAR to \"git notes\" (perhaps\neven using \"git notes\") to store and apply patches for such bad\ncommits?\n\nFor instance, bisecting could transparently apply any patches that\nare necessary to make a bad commit actually buildable; such patches\ncould be distributed as usual for the benefit of others.\n\nI'm thinking that a \"patch note\" could have 2 forms:\n\n    * A plain patch file (or maybe a git tree of patches).\n\n    * A reference to another commit that should be checked\n      out instead.\n\nIs this a worthwhile idea?\n\nSincerely,\nMichael Witten\n"},{"id":"144422","messageId":"AANLkTimAAtO9p2rQW4pITKQehhYF6pppBUgPxoyrLOvA@mail.gmail.com","threadId":"24222","inReplyTo":"4c291e41.4f1ee30a.3484.fffff729@mx.google.com","subject":"Re: Patching bad commits","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-06-28T22:23:44Z","receivedAt":"2010-06-28T22:23:44Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Mon, Jun 28, 2010 at 6:03 PM, Michael Witten <mfwitten@gmail.com> wrote:\n> Sometimes bisecting is less than useful because a number of commits\n> fail to build.\n>\n> How about implementing something SIMILAR to \"git notes\" (perhaps\n> even using \"git notes\") to store and apply patches for such bad\n> commits?\n\nYou could probably use the (relatively new) 'git replace' feature for\nthis.  Just replace the broken tree object with a new one that doesn't\nhave the bug.  I've never tried it, but it does seem like it should\nwork.\n\nThat said, this idea would require you to manually patch every single\ncommit that ever had a problem.  I'm not sure there's much benefit to\nthat compared to the overwhelming cost.  I think it might be more\nuseful - and much easier -to just have a permanent \"always skip these\ncommits when bisecting\" list.  (I don't think such a feature exists\nyet though.)\n\nBtw, in recent versions of git, 'git bisect skip' is pretty smart and\nseeks around in the tree in such a way that it doesn't hurt so much\nwhen you have a batch of bad commits somewhere in the middle.  So you\nmay find that it's really not that bad to just use 'git bisect skip'\noccasionally if your version of git is relatively new and your history\nisn't absolutely littered with crap.\n\nSpeaking of littering your history with crap, the an ounce of\nprevention is worth a pound of cure: make sure all your commits pass\nunit tests before committing, and you'll rarely have this problem\nanyway :)  That's obviously easier said than done however.\n\nHave fun,\n\nAvery\n"},{"id":"144423","messageId":"AANLkTikfrAk9xDNhcHDJupuWBKrxExKE1N78rJWDTUYF@mail.gmail.com","threadId":"24222","inReplyTo":"4c291e41.4f1ee30a.3484.fffff729@mx.google.com","subject":"Re: Patching bad commits","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-06-28T22:24:18Z","receivedAt":"2010-06-28T22:24:18Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Jun 29, 2010 at 00:03, Michael Witten <mfwitten@gmail.com> wrote:\n> How about implementing something SIMILAR to \"git notes\" (perhaps\n> even using \"git notes\") to store and apply patches for such bad\n> commits?\n\nDefinitely use 'git notes' for this, I'd say this is a perfect use\ncase for it. Just store the patches in their own notes ref and you're\ngood to go.\n\n> For instance, bisecting could transparently apply any patches that\n> are necessary to make a bad commit actually buildable; such patches\n> could be distributed as usual for the benefit of others.\n\nSomething like that should probably be guarded by a\nswitch/configuration value, but that sounds very useful.\n\n>    * A plain patch file (or maybe a git tree of patches).\n\nI guess in this form 'git bisect' could just call 'git am' on that\ntree (regardless of whether it has 1 or more patches), which would\napply them in the usual order? It might be useful to instead stream\nthe contents of the note to 'git am', but I could imagine it being\nuseful to have the patches on disk (so that you can edit them, or look\nat them when applying fails).\n\n>    * A reference to another commit that should be checked\n>      out instead.\n\nI'm not sure how useful that is, if you're just going to check out\nanother commit you might as well 'git bisect skip' the current one?\nWell, I guess if the other commit is outside the bisect range but is\napplied on top of the commit under inspection it makes sense. So makes\nsense, only problem I see is that if that commit is on another branch\nit might not be available locally.\n\n> Is this a worthwhile idea?\n\nI like this idea a lot, it's always bothered me that some commits can\njust come up during git bisect as being untestable. The tricky part\nwill be to ensure that the patches you apply don't affect the bug ;).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"144804","messageId":"AANLkTilrvCyCCIlU9M1HPAdxLREvyVL0pKyNsJR2wpN7@mail.gmail.com","threadId":"24222","inReplyTo":"AANLkTimAAtO9p2rQW4pITKQehhYF6pppBUgPxoyrLOvA@mail.gmail.com","subject":"Re: Patching bad commits","fromName":"Antriksh Pany","fromEmail":"antriksh.pany@gmail.com","sentAt":"2010-07-05T08:37:20Z","receivedAt":"2010-07-05T08:37:20Z","isPatch":false,"sender":{"key":"antriksh.pany@gmail.com","avatar":null},"body":"On Tue, Jun 29, 2010 at 3:53 AM, Avery Pennarun <apenwarr@gmail.com> wrote:\n> On Mon, Jun 28, 2010 at 6:03 PM, Michael Witten <mfwitten@gmail.com> wrote:\n>> Sometimes bisecting is less than useful because a number of commits\n>> fail to build.\n>>\n\nYou could automate the process of skipping certain commits when build fails.\n  make || git bisect skip\nAutomatically mark commits as bad when your test fails:\n  ./test || git bisect bad\nOtherwise 'git bisect good' is what you do.\n\nI think you can put these together in a loop that works automatically\nwithout much user intervention.\n\nHope this helps.\n\nCheers\nAntriksh Pany\n"}]}