Skip to content

Commit

Permalink
Fix 'git commit -a' in a newly initialized repository
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
frekui authored and Junio C Hamano committed Feb 23, 2007
1 parent 4917d2a commit 755b99d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 755b99d

Please sign in to comment.