{"thread":{"id":"25616","subject":"git commit -C vs. prepare-commit-msg hook","startedAt":"2010-11-02T14:50:59Z","lastAt":"2010-11-02T23:01:12Z","messageCount":3,"participants":["SZEDER Gábor","Pat Notz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"154971","messageId":"20101102145059.GB2116@neumann","threadId":"25616","inReplyTo":null,"subject":"git commit -C vs. prepare-commit-msg hook","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-11-02T14:50:59Z","receivedAt":"2010-11-02T14:50:59Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nJust noticed (read: got bitten by ;) that 'git commit' runs the\nprepare-commit-msg hook even if it was invoked with the -C option.\nThis seems contradictory to me, because 'git commit -C' is to reuse an\nalready existing log message (and author info) as is, whereas\nprepare-commit-msg is there to automatically edit the commit message.\n\nIs this desired and I'm missing something, or is this a bug?  (or just\naccidental, but we can't do anything about it anyway because of\nbackward compatibility?)\n\nThanks.\n\n\nBest,\nGábor\n"},{"id":"154998","messageId":"AANLkTimdjAc1ZKNkWAO_KU8CqorShMv0TNDvsy5qmSDw@mail.gmail.com","threadId":"25616","inReplyTo":"20101102145059.GB2116@neumann","subject":"Re: git commit -C vs. prepare-commit-msg hook","fromName":"Pat Notz","fromEmail":"patnotz@gmail.com","sentAt":"2010-11-02T20:11:33Z","receivedAt":"2010-11-02T20:11:33Z","isPatch":false,"sender":{"key":"patnotz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45364?v=4"},"body":"2010/11/2 SZEDER Gábor <szeder@ira.uka.de>:\n> Hi,\n>\n> Just noticed (read: got bitten by ;) that 'git commit' runs the\n> prepare-commit-msg hook even if it was invoked with the -C option.\n> This seems contradictory to me, because 'git commit -C' is to reuse an\n> already existing log message (and author info) as is, whereas\n> prepare-commit-msg is there to automatically edit the commit message.\n>\n\nCan your hook look for the presence of the third command line argument\nto catch this case?  Granted, you won't be able to tell the difference\nbetween -C and -c or --amend.\n\n> Is this desired and I'm missing something, or is this a bug?  (or just\n> accidental, but we can't do anything about it anyway because of\n> backward compatibility?)\n>\n> Thanks.\n>\n>\n> Best,\n> Gábor\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"155009","messageId":"20101102230112.GC2116@neumann","threadId":"25616","inReplyTo":"AANLkTimdjAc1ZKNkWAO_KU8CqorShMv0TNDvsy5qmSDw@mail.gmail.com","subject":"Re: git commit -C vs. prepare-commit-msg hook","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2010-11-02T23:01:12Z","receivedAt":"2010-11-02T23:01:12Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi Pat,\n\n\nThanks for your reply.\n\nOn Tue, Nov 02, 2010 at 02:11:33PM -0600, Pat Notz wrote:\n> 2010/11/2 SZEDER Gábor <szeder@ira.uka.de>:\n> > Hi,\n> >\n> > Just noticed (read: got bitten by ;) that 'git commit' runs the\n> > prepare-commit-msg hook even if it was invoked with the -C option.\n> > This seems contradictory to me, because 'git commit -C' is to reuse an\n> > already existing log message (and author info) as is, whereas\n> > prepare-commit-msg is there to automatically edit the commit message.\n> >\n> \n> Can your hook look for the presence of the third command line argument\n> to catch this case?\n\nYeah, this is what I tried as workaround ...\n\n> Granted, you won't be able to tell the difference between -C and -c\n> or --amend.\n\n... and this is why it didn't work out, i.e. I needed to differentiate\n-C from -c or --amend.\n\n> > Is this desired and I'm missing something, or is this a bug?  (or just\n> > accidental, but we can't do anything about it anyway because of\n> > backward compatibility?)\n"}]}