From: Fredrik Kuivinen Date: Thu, 22 Feb 2007 20:28:12 +0000 (+0100) Subject: Fix 'git commit -a' in a newly initialized repository X-Git-Tag: v1.5.0.2~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=755b99d81539461645088085ea033a3b36152da5;p=git.git 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 --- diff --git a/git-commit.sh b/git-commit.sh index ec506d956..476f4f18d 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 &&