{"thread":{"id":"30283","subject":"[GUILT] Preventing \"git push\" when guilt patches are applied","startedAt":"2012-04-19T07:23:15Z","lastAt":"2012-04-30T10:34:46Z","messageCount":3,"participants":["Per Cederqvist","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189688","messageId":"4F8FBD63.9050507@opera.com","threadId":"30283","inReplyTo":null,"subject":"[GUILT] Preventing \"git push\" when guilt patches are applied","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2012-04-19T07:23:15Z","receivedAt":"2012-04-19T07:23:15Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"I have by accident done \"git push\" when I intended to write \"guilt\npush\" a couple of times.  If there are guilt patches applied when I do\nthis the result is that (part of) my half-finished patch series is\npushed to the master branch.  That is of course not good.\n\nTopGit avoids this issue since I'm on a separate branch when patches\nare applied.\n\nMercurial Queues prevents this.  If I try to do \"hg push\" with a patch\napplied, I get this error:\n\n > pushing to /home/cederp/pushstop/hgmaster\n > abort: source has mq patches applied\n\nI'd like to add something similar to Guilt, to avoid making this\nmistake ever again.  (It is quite embarrassing to clean up after you\npush a couple of half-baked patches.)  But I don't know how the\nfeature should be designed.  Some ideas:\n\n  - Add pre-push hooks to Git, like the one proposed back in 2008 in\n    <http://thread.gmane.org/gmane.comp.version-control.git/92900>.\n    Have Guilt automatically install a pre-push hook that produces an\n    error message if Guilt patches are applied.\n\n  - Have Guilt create a status file (maybe .git/PUSH_FORBIDDEN)\n    whenever patches are applied, and remove the file when it pops all\n    patches.  The file would contain the following text: \"Refusing to\n    push while guilt patches are applied.  Hint: see 'guilt -h\n    commit'.\"  Have \"git push\" check for that file, and print its\n    contents if it exists.  (Or should \"git push\" check for any file\n    matching the glob pattern \".git/PUSH_FORBIDDEN.*\" and Guilt create\n    .git/PUSH_FORBIDDEN.Guilt so that this mechanism is more\n    extensible?)\n\n  - Have Guilt remove all remotes when patches are pushed, and restore\n    them when all patches are popped.  (I don't like this idea; there\n    are too many things that could go wrong.  But it would be possible\n    to implement without doing any changes to Git itself.)\n\nI hope the Git community can come up with a better design for this\nfeature.\n\n     /ceder\n"},{"id":"189708","messageId":"CAPc5daV4mK7aLRAm4Ow9TBPf5Tj3B=Qpf0=cRXjbeZoOuoYMKQ@mail.gmail.com","threadId":"30283","inReplyTo":"4F8FBD63.9050507@opera.com","subject":"Re: [GUILT] Preventing \"git push\" when guilt patches are applied","fromName":"Junio C Hamano","fromEmail":"gitster-vger@pobox.com","sentAt":"2012-04-19T15:19:58Z","receivedAt":"2012-04-19T15:19:58Z","isPatch":false,"sender":{"key":"gitster-vger@pobox.com","avatar":null},"body":"On Thu, Apr 19, 2012 at 12:23 AM, Per Cederqvist <cederp@opera.com> wrote:\n> I have by accident done \"git push\" when I intended to write \"guilt\n> push\" a couple of times.  If there are guilt patches applied when I do\n> this the result is that (part of) my half-finished patch series is\n> pushed to the master branch.  That is of course not good.\n>\n> TopGit avoids this issue since I'm on a separate branch when patches\n> are applied.\n> ...\n> I'd like to add something similar to Guilt, to avoid making this\n> mistake ever again.  (It is quite embarrassing to clean up after you\n> push a couple of half-baked patches.)  But I don't know how the\n> feature should be designed.  Some ideas:\n> ...\n\nIsn't the most obvious one (somehow missing from your list) from your\nobservation you\ndescribed earlier to have guilt apply patches on a separate branch?\n\nWould it also work to set \"[push] default = none\"?  Then \"git push\"\ntyped by mistake for\n\"guilt push\" (I am assuming that \"$whichever push\" does not take any\nother argument,\nand that is the root cause of your fat-finger-embarrassment issue)\nwould not push anything\nout.\n"},{"id":"190288","messageId":"4F9E6AC6.9070606@opera.com","threadId":"30283","inReplyTo":"CAPc5daV4mK7aLRAm4Ow9TBPf5Tj3B=Qpf0=cRXjbeZoOuoYMKQ@mail.gmail.com","subject":"Re: [GUILT] Preventing \"git push\" when guilt patches are applied","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2012-04-30T10:34:46Z","receivedAt":"2012-04-30T10:34:46Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"On 04/19/2012 05:19 PM, Junio C Hamano wrote:\n> On Thu, Apr 19, 2012 at 12:23 AM, Per Cederqvist<cederp@opera.com>  wrote:\n>> I have by accident done \"git push\" when I intended to write \"guilt\n>> push\" a couple of times.  If there are guilt patches applied when I do\n>> this the result is that (part of) my half-finished patch series is\n>> pushed to the master branch.  That is of course not good.\n>>\n>> TopGit avoids this issue since I'm on a separate branch when patches\n>> are applied.\n>> ...\n>> I'd like to add something similar to Guilt, to avoid making this\n>> mistake ever again.  (It is quite embarrassing to clean up after you\n>> push a couple of half-baked patches.)  But I don't know how the\n>> feature should be designed.  Some ideas:\n>> ...\n>\n> Isn't the most obvious one (somehow missing from your list) from your\n> observation you\n> described earlier to have guilt apply patches on a separate branch?\n\nIt wasn't obvious to me, but I think it is a good idea. I've posted\nan implementation of this here:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/196546\n\n> Would it also work to set \"[push] default = none\"?  Then \"git push\"\n> typed by mistake for\n> \"guilt push\" (I am assuming that \"$whichever push\" does not take any\n> other argument,\n> and that is the root cause of your fat-finger-embarrassment issue)\n> would not push anything\n> out.\n\nThat would maybe help me, but I would still be reluctant to recommend\nGuilt to my friends, as I don't want to be the reason they make stupid\nmistakes. :-)\n\n     /ceder\n"}]}