@matheusbsbs / matheus-bagliano / commits / ef4cffde9c
Fork 0

git-clone: print an error message when trying to clone empty repo

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>

Jeff King committed Dec 11, 2007 at 07:53 UTC ef4cffde9cf45a4203be5f78cf8f025f4f694a66
1 file changed +2 -1
git-clone.sh
+2 -1
@@ -297,7 +297,8 @@ yes)
297 find objects -type f -print | sed -e 1q)
298 # objects directory should not be empty because
299 # we are cloning!
300 - test -f "$repo/$sample_file" || exit
300 + test -f "$repo/$sample_file" ||
301 + die "fatal: cannot clone empty repository"
302 if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
303 then
304 rm -f "$GIT_DIR/objects/sample"