{"thread":{"id":"6916","subject":"[PATCH] Fix 'git commit -a' in a newly initialized repository","startedAt":"2007-02-22T20:28:12Z","lastAt":"2007-02-23T05:03:02Z","messageCount":9,"participants":["Fredrik Kuivinen","Johannes Schindelin","Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"35261","messageId":"20070222202812.8882.44375.stgit@c165","threadId":"6916","inReplyTo":null,"subject":"[PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2007-02-22T20:28:12Z","receivedAt":"2007-02-22T20:28:12Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"\nWith current git:\n\n$ git init\n$ git commit -a\ncp: cannot stat `.git/index': No such file or directory\n\nOutput a nice error message instead.\n\nSigned-off-by: Fredrik Kuivinen <frekui@gmail.com>\n\n---\n\n git-commit.sh |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex ec506d9..476f4f1 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -318,6 +318,10 @@ esac\n \n case \"$all,$also\" in\n t,)\n+\tif test ! -f \"$THIS_INDEX\"\n+\tthen\n+\t\tdie 'nothing to commit (use \"git add file1 file2\" to include for commit)'\n+\tfi\n \tsave_index &&\n \t(\n \t\tcd_to_toplevel &&\n"},{"id":"35264","messageId":"Pine.LNX.4.63.0702222140360.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6916","inReplyTo":"20070222202812.8882.44375.stgit@c165","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-22T20:42:33Z","receivedAt":"2007-02-22T20:42:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Feb 2007, Fredrik Kuivinen wrote:\n\n> +\t\tdie 'nothing to commit (use \"git add file1 file2\" to include for commit)'\n\nWould it not make more sense to tell the user about \"git add .\"? Maybe \ntogether with a hint about .gitignore?\n\nThis error message is important. The most likely recipients are total git \nnewsters, and we really should try to help them here.\n\nCiao,\nDscho\n"},{"id":"35269","messageId":"alpine.LRH.0.82.0702221550290.27932@xanadu.home","threadId":"6916","inReplyTo":"Pine.LNX.4.63.0702222140360.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-22T20:54:37Z","receivedAt":"2007-02-22T20:54:37Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 22 Feb 2007, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Thu, 22 Feb 2007, Fredrik Kuivinen wrote:\n> \n> > +\t\tdie 'nothing to commit (use \"git add file1 file2\" to include for commit)'\n> \n> Would it not make more sense to tell the user about \"git add .\"?\n\nIsn't what the patch does?  IMHO it looks just like the empty commit \nmessage which is good.\n\n> Maybe \n> together with a hint about .gitignore?\n> \n> This error message is important. The most likely recipients are total git \n> newsters, and we really should try to help them here.\n\nSure.  But to really help newsters it is better _not_ to talk about \n.gitignore at all.  It certainly won't exist at that point anyway.\n\n\nNicolas\n"},{"id":"35271","messageId":"Pine.LNX.4.63.0702222157000.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6916","inReplyTo":"alpine.LRH.0.82.0702221550290.27932@xanadu.home","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-22T20:59:33Z","receivedAt":"2007-02-22T20:59:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Feb 2007, Nicolas Pitre wrote:\n\n> On Thu, 22 Feb 2007, Johannes Schindelin wrote:\n> \n> > On Thu, 22 Feb 2007, Fredrik Kuivinen wrote:\n> > \n> > > +\t\tdie 'nothing to commit (use \"git add file1 file2\" to include for commit)'\n> > \n> > Would it not make more sense to tell the user about \"git add .\"?\n> \n> Isn't what the patch does?  IMHO it looks just like the empty commit \n> message which is good.\n\nI wanted to get at the \".\" thing. You know, when I start a project with \ngit, there are usually some files there already. Provided I have a \n.gitignore there, I can just say \"git add .\" and be done.\n\nBut maybe that is _not_ common practice?\n\n> > Maybe together with a hint about .gitignore?\n> > \n> > This error message is important. The most likely recipients are total \n> > git newsters, and we really should try to help them here.\n> \n> Sure.  But to really help newsters it is better _not_ to talk about \n> .gitignore at all.  It certainly won't exist at that point anyway.\n\nHmm. That is a really good point. Hmmm. I think you're right.\n\nCiao,\nDscho\n"},{"id":"35272","messageId":"alpine.LRH.0.82.0702221605080.27932@xanadu.home","threadId":"6916","inReplyTo":"Pine.LNX.4.63.0702222157000.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-22T21:09:55Z","receivedAt":"2007-02-22T21:09:55Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 22 Feb 2007, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Thu, 22 Feb 2007, Nicolas Pitre wrote:\n> \n> > On Thu, 22 Feb 2007, Johannes Schindelin wrote:\n> > \n> > > On Thu, 22 Feb 2007, Fredrik Kuivinen wrote:\n> > > \n> > > > +\t\tdie 'nothing to commit (use \"git add file1 file2\" to include for commit)'\n> > > \n> > > Would it not make more sense to tell the user about \"git add .\"?\n> > \n> > Isn't what the patch does?  IMHO it looks just like the empty commit \n> > message which is good.\n> \n> I wanted to get at the \".\" thing. You know, when I start a project with \n> git, there are usually some files there already. Provided I have a \n> .gitignore there, I can just say \"git add .\" and be done.\n> \n> But maybe that is _not_ common practice?\n\nWell... If you're that acquainted with GIT to perform the above, I'm \nsure a message like \"use \"git add file1 file2\" to include for commit\" \nwon't leave you puzzled.  ;-)\n\n\nNicolas\n"},{"id":"35274","messageId":"Pine.LNX.4.63.0702222213120.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6916","inReplyTo":"alpine.LRH.0.82.0702221605080.27932@xanadu.home","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-22T21:13:38Z","receivedAt":"2007-02-22T21:13:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Feb 2007, Nicolas Pitre wrote:\n\n> On Thu, 22 Feb 2007, Johannes Schindelin wrote:\n> \n> > I wanted to get at the \".\" thing. You know, when I start a project \n> > with git, there are usually some files there already. Provided I have \n> > a .gitignore there, I can just say \"git add .\" and be done.\n> > \n> > But maybe that is _not_ common practice?\n> \n> Well... If you're that acquainted with GIT to perform the above, I'm \n> sure a message like \"use \"git add file1 file2\" to include for commit\" \n> won't leave you puzzled.  ;-)\n\n;-) Yes, you are right!\n\nCiao,\nDscho\n"},{"id":"35275","messageId":"7vhctddge7.fsf@assigned-by-dhcp.cox.net","threadId":"6916","inReplyTo":"alpine.LRH.0.82.0702221605080.27932@xanadu.home","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-22T21:36:00Z","receivedAt":"2007-02-22T21:36:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"If we want to limit the help to lone liner, I am with Nicolas and\nFredrik on this one.  Suggesting only \"git add .\" does not feel\nhelpful.\n\nHowever, because ! test -f \"$THIS_INDEX\" is such a special case\n(totally new check-in), we can afford to be verbose if we wanted\nto, and offer tons of possibilities, say:\n\n\tdie 'nothing to commit.  You can use \"git add file...\"\nto include individual files, or use \"git add .\" if you want to \ninclude all files in the current directory, for your first\ncommit.'\n\nBut if we want to say \"for your first commit\" in the message, we\nshould also be checking if HEAD commit really does not exist.\n"},{"id":"35280","messageId":"alpine.LRH.0.82.0702221904210.27932@xanadu.home","threadId":"6916","inReplyTo":"7vhctddge7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-23T00:06:41Z","receivedAt":"2007-02-23T00:06:41Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 22 Feb 2007, Junio C Hamano wrote:\n\n> However, because ! test -f \"$THIS_INDEX\" is such a special case\n> (totally new check-in), we can afford to be verbose if we wanted\n> to, and offer tons of possibilities, say:\n> \n> \tdie 'nothing to commit.  You can use \"git add file...\"\n> to include individual files, or use \"git add .\" if you want to \n> include all files in the current directory, for your first\n> commit.'\n> \n> But if we want to say \"for your first commit\" in the message, we\n> should also be checking if HEAD commit really does not exist.\n\nSeems to me that the single line message avoids all those issues.\n\n\nNicolas\n"},{"id":"35294","messageId":"7vlkipbh4p.fsf@assigned-by-dhcp.cox.net","threadId":"6916","inReplyTo":"alpine.LRH.0.82.0702221904210.27932@xanadu.home","subject":"Re: [PATCH] Fix 'git commit -a' in a newly initialized repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-23T05:03:02Z","receivedAt":"2007-02-23T05:03:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n> On Thu, 22 Feb 2007, Junio C Hamano wrote:\n>\n>> However, because ! test -f \"$THIS_INDEX\" is such a special case\n>> (totally new check-in), we can afford to be verbose if we wanted\n>> to, and offer tons of possibilities, say:\n>> \n>> \tdie 'nothing to commit.  You can use \"git add file...\"\n>> to include individual files, or use \"git add .\" if you want to \n>> include all files in the current directory, for your first\n>> commit.'\n>> \n>> But if we want to say \"for your first commit\" in the message, we\n>> should also be checking if HEAD commit really does not exist.\n>\n> Seems to me that the single line message avoids all those issues.\n\nYup.  Will apply Fredrik's original to 'maint'.\n"}]}