Re: Cloning empty repositories, was Re: What is the idea for bare repositories?
- From
Jeff King <peff@peff.net>
- Date
- Nov 18, 2007, 00:25 UTC
- Message-ID
- <20071118002514.GA4458@sigill.intra.peff.net>
- In-Reply-To
- <7vfxz8hbcf.fsf@gitster.siamese.dyndns.org>
Junio, can I get an ACK or NAK on the patch below? There doesn't seem to be a patch for making cloning empty repos work on the horizon, but can we at least improve the error message?
-- >8 -- 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.
---
diff --git a/git-clone.sh b/git-clone.sh index 18003ab..e2b7a9c 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -278,7 +278,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"