Skip to content

Commit

Permalink
git-clone: print an error message when trying to clone empty repo
Browse files Browse the repository at this point in the history
Previously, cloning an empty repository looked like this:

$ (mkdir parent && cd parent && git --bare init)
$ git-clone parent child
Initialized empty Git repository in /home/peff/clone/child/.git/
$ cd child
-bash: cd: child: No such file or directory
$ echo 'wtf?' | mail git@vger.kernel.org

Now we at least report that the clone was not successful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Dec 11, 2007
1 parent 18ff365 commit ef4cffd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ yes)
find objects -type f -print | sed -e 1q)
# objects directory should not be empty because
# we are cloning!
test -f "$repo/$sample_file" || exit
test -f "$repo/$sample_file" ||
die "fatal: cannot clone empty repository"
if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
then
rm -f "$GIT_DIR/objects/sample"
Expand Down

0 comments on commit ef4cffd

Please sign in to comment.