Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-clone: print an error message when trying to clone empty repo
author
Jeff King
<peff@peff.net>
Tue, 11 Dec 2007 12:53:47 +0000
(07:53 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 11 Dec 2007 19:07:23 +0000
(11:07 -0800)
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>
git-clone.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
18ff365
)
diff --git
a/git-clone.sh
b/git-clone.sh
index ecf9d89a108484af3f73817e60c523f1dca8fff0..96a356d8b33e8caa1b60e4b37b3e37086db74027 100755
(executable)
--- a/
git-clone.sh
+++ b/
git-clone.sh
@@
-297,7
+297,8
@@
yes)
find objects -type f -print | sed -e 1q)
# objects directory should not be empty because
# we are cloning!
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"
if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
then
rm -f "$GIT_DIR/objects/sample"