{"thread":{"id":"43269","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","startedAt":"2006-11-30T12:59:32Z","lastAt":"2006-12-01T15:17:59Z","messageCount":7,"participants":["Johannes Schindelin","Alex Riesen","Andy Parkins","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"297058","messageId":"200611301259.32387.andyparkins@gmail.com","threadId":"43269","inReplyTo":null,"subject":"[PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-11-30T12:59:32Z","receivedAt":"2006-11-30T12:59:32Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"Raimund Bauer offered this suggestion (paraphrased):\n\n\"Maybe we could do git-commit -a  _only_ if the index matches HEAD, and\notherwise keep current behavior?  So people who don't care about the\nindex won't get tripped up, and when you do have a dirty index, you get\ntold about it?\"\n\nJohannes Schindelin pointed out that this isn't the right thing to do for\nan --amend, so that is checked for.\n\nAdditionally, it's probably not the right thing to do if any files are\nspecified with \"--only\" or \"--include\", so they turn this behaviour off\nas well.\n\nSigned-off-by: Andy Parkins <andyparkins@gmail.com>\n---\nI've been using this today, and so far it's been quite friendly.  git-commit\nis suddenly just doing the Right Thing.\n\nIt's so good that the only (small) hurdle, is remembering during an amend\nthat you need to update the index first to get any code changes in to the\namend - but that is the same as it ever was.\n\n git-commit.sh |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 81c3a0c..e9aed2b 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -265,6 +265,13 @@ $1\"\n done\n case \"$edit_flag\" in t) no_edit= ;; esac\n \n+# Clever commit - if this commit would do nothing, then make it an \"all\"\n+# commit\n+if [ -z \"$(git-diff-index --cached --name-only HEAD)\" \\\n+\t-a -z \"$amend\" -a -z \"$only\" -a -z \"$also\" ]; then\n+\tall=t\n+fi\n+\n ################################################################\n # Sanity check options\n \n-- \n1.4.4.1.g3ece-dirty\n"},{"id":"297592","messageId":"ekmlar$ask$2@sea.gmane.org","threadId":"43269","inReplyTo":"200611301259.32387.andyparkins@gmail.com","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-30T13:13:47Z","receivedAt":"2006-11-30T13:13:47Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Andy Parkins wrote:\n\n> Raimund Bauer offered this suggestion (paraphrased):\n> \n> \"Maybe we could do git-commit -a  _only_ if the index matches HEAD, and\n> otherwise keep current behavior?  So people who don't care about the\n> index won't get tripped up, and when you do have a dirty index, you get\n> told about it?\"\n> \n> Johannes Schindelin pointed out that this isn't the right thing to do for\n> an --amend, so that is checked for.\n> \n> Additionally, it's probably not the right thing to do if any files are\n> specified with \"--only\" or \"--include\", so they turn this behaviour off\n> as well.\n\nCould we add suggestion by Andreas Ericsson to print in the \"smart commit\"\ncase:\n\n  Nothing to commit but changes in working tree. Assuming 'git commit -a'\n\nor something like that?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"294188","messageId":"Pine.LNX.4.63.0611301632560.30004@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43269","inReplyTo":"ekmlar$ask$2@sea.gmane.org","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-11-30T15:34:04Z","receivedAt":"2006-11-30T15:34:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 30 Nov 2006, Jakub Narebski wrote:\n\n> Could we add suggestion by Andreas Ericsson to print in the \"smart \n> commit\" case:\n> \n>   Nothing to commit but changes in working tree. Assuming 'git commit -a'\n> \n> or something like that?\n\nOnly that you would not see it (or ignore it, as has been illustrated in \nanother thread), because your editor pops up, hiding that message.\n\nCiao,\nDscho\n"},{"id":"297127","messageId":"81b0412b0611300914u521a5351idde23618c2fbf017@mail.gmail.com","threadId":"43269","inReplyTo":"200611301259.32387.andyparkins@gmail.com","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-11-30T17:14:50Z","receivedAt":"2006-11-30T17:14:50Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/30/06, Andy Parkins <andyparkins@gmail.com> wrote:\n> \"Maybe we could do git-commit -a  _only_ if the index matches HEAD, and\n> otherwise keep current behavior?  So people who don't care about the\n> index won't get tripped up, and when you do have a dirty index, you get\n> told about it?\"\n\nThe is dangerous on filesystems which lie to the programs about file metadata.\nThe \"virtual filesystem\" of cygwin is one of this kind: exec-bit of\nthe files depend\non its contents. Just calling git-commit -a will commit executability\nat this particular\nmoment. For whatever reason, disabling handling of the exec-mode in gits config\ndoes not work.\n\nIf you about to change the behaviour, provide at least a config option\nto go back\n"},{"id":"295050","messageId":"200612011052.48784.andyparkins@gmail.com","threadId":"43269","inReplyTo":"81b0412b0611300914u521a5351idde23618c2fbf017@mail.gmail.com","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-12-01T10:52:47Z","receivedAt":"2006-12-01T10:52:47Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2006 November 30 17:14, Alex Riesen wrote:\n\n> The is dangerous on filesystems which lie to the programs about file\n> metadata. The \"virtual filesystem\" of cygwin is one of this kind: exec-bit\n> of the files depend\n> on its contents. Just calling git-commit -a will commit executability\n> at this particular\n> moment. For whatever reason, disabling handling of the exec-mode in gits\n> config does not work.\n\nSurely this is a separate fault?\n\n> If you about to change the behaviour, provide at least a config option\n> to go back\n> to the old git-commit, which didn't do any magic.\n\nWasn't the whole point of this to avoid needing another config option?\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIEE\n"},{"id":"294995","messageId":"81b0412b0612010507r5e6ee226t3a1e61113bf15d43@mail.gmail.com","threadId":"43269","inReplyTo":"200612011052.48784.andyparkins@gmail.com","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-12-01T13:07:38Z","receivedAt":"2006-12-01T13:07:38Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/1/06, Andy Parkins <andyparkins@gmail.com> wrote:\n>\n> > The is dangerous on filesystems which lie to the programs about file\n> > metadata. The \"virtual filesystem\" of cygwin is one of this kind: exec-bit\n> > of the files depend\n> > on its contents. Just calling git-commit -a will commit executability\n> > at this particular\n> > moment. For whatever reason, disabling handling of the exec-mode in gits\n> > config does not work.\n>\n> Surely this is a separate fault?\n>\n\nOf course it is. It's just that the problem is not solved yet,\nand if -a becomes git-commit's default a simple git-commit\nwill be a real annoying thing.\n\n> > If you about to change the behavior, provide at least a config option\n> > to go back\n> > to the old git-commit, which didn't do any magic.\n>\n> Wasn't the whole point of this to avoid needing another config option?\n>\n\n"},{"id":"298029","messageId":"200612011518.00575.andyparkins@gmail.com","threadId":"43269","inReplyTo":"81b0412b0612010507r5e6ee226t3a1e61113bf15d43@mail.gmail.com","subject":"Re: [PATCH/RFC] Make git-commit cleverer - have it figure out whether it needs -a automatically","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-12-01T15:17:59Z","receivedAt":"2006-12-01T15:17:59Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2006 December 01 13:07, Alex Riesen wrote:\n\n> Of course it is. It's just that the problem is not solved yet,\n> and if -a becomes git-commit's default a simple git-commit\n> will be a real annoying thing.\n\nThere was talk of making git-commit -a; bear in mind that this patch was to \ncompletely sidestep making that default.  This patch has no effect on \nexisting behaviour save for one special case: when commit would otherwise \nhave done nothing, it now does \"git-commit -a\".\n\nIf you have a problem with git-commit -a, then presumably you are already \nusing git-update-index for all your commit needs; in which case this patch \nhas zero impact on you.\n\n> > Wasn't the whole point of this to avoid needing another config option?\n>\n> was it it the point of breaking existing setups?\n\nOf course it isn't; I have no intention of breaking yours or anybody else's \nsetup.  However, as your complaint is that this patch highlights another bug, \nI would think the solution is fix the other bug, instead of botch around it \nin this patch.\n\nPerhaps I was a little terse; what I should have said was - I don't really \nwant to solve this executable bit problem with a config option; as that's \npapering over the cracks.  If executable bits are a problem, well why not \ndetect when that's the case automatically.  I don't have a cygwin environment \nso I have no way to test what you ask for.\n\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIEE\n"}]}