git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix 'git commit -a' in a newly initialized repository
@ 2007-02-22 20:28 Fredrik Kuivinen
  2007-02-22 20:42 ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Fredrik Kuivinen @ 2007-02-22 20:28 UTC (permalink / raw)
  To: git


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 &&

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-23  5:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-22 20:28 [PATCH] Fix 'git commit -a' in a newly initialized repository Fredrik Kuivinen
2007-02-22 20:42 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).