From 755b99d81539461645088085ea033a3b36152da5 Mon Sep 17 00:00:00 2001 From: Fredrik Kuivinen Date: Thu, 22 Feb 2007 21:28:12 +0100 Subject: Fix 'git commit -a' in a newly initialized repository 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 Signed-off-by: Junio C Hamano --- git-commit.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git-commit.sh') diff --git a/git-commit.sh b/git-commit.sh index ec506d956f..476f4f18db 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 && -- cgit v1.2.3