All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fredrik Kuivinen <frekui@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Fix 'git commit -a' in a newly initialized repository
Date: Thu, 22 Feb 2007 21:28:12 +0100	[thread overview]
Message-ID: <20070222202812.8882.44375.stgit@c165> (raw)


With current git:

$ git init
$ git commit -a
cp: cannot stat `.git/index': No such file or directory

Output a nice error message instead.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>

---

 git-commit.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index ec506d9..476f4f1 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -318,6 +318,10 @@ esac
 
 case "$all,$also" in
 t,)
+	if test ! -f "$THIS_INDEX"
+	then
+		die 'nothing to commit (use "git add file1 file2" to include for commit)'
+	fi
 	save_index &&
 	(
 		cd_to_toplevel &&

             reply	other threads:[~2007-02-22 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22 20:28 Fredrik Kuivinen [this message]
2007-02-22 20:42 ` [PATCH] Fix 'git commit -a' in a newly initialized repository Johannes Schindelin
2007-02-22 20:54   ` Nicolas Pitre
2007-02-22 20:59     ` Johannes Schindelin
2007-02-22 21:09       ` Nicolas Pitre
2007-02-22 21:13         ` Johannes Schindelin
2007-02-22 21:36         ` Junio C Hamano
2007-02-23  0:06           ` Nicolas Pitre
2007-02-23  5:03             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070222202812.8882.44375.stgit@c165 \
    --to=frekui@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.