]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Make `vcsh clone` handle empty remotes gracefully
authorRichard Hartmann <richih.mailinglist@gmail.com>
Tue, 6 Dec 2011 20:54:35 +0000 (21:54 +0100)
committerRichard Hartmann <richih.mailinglist@gmail.com>
Tue, 6 Dec 2011 21:07:44 +0000 (22:07 +0100)
TODO
vcsh

diff --git a/TODO b/TODO
index 8f5b1bf2e55bccc735e3ec9561d37c6e4e65784e..4cb60935dc2b88c8d4ca7ba607b49816abae98c4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-* vcsh clone fails when remote is empty
-
 # Related #
 
 * Package for Debian
 # Related #
 
 * Package for Debian
diff --git a/vcsh b/vcsh
index ec0301f247822a053b85c9a90a962446377ecc0d..4979d71079627dd304ac9ebe132b55813836e4f7 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -64,6 +64,10 @@ clone() {
        git remote add origin "$GIT_REMOTE"
        git config branch.master.remote origin
        git config branch.master.merge  refs/heads/master
        git remote add origin "$GIT_REMOTE"
        git config branch.master.remote origin
        git config branch.master.merge  refs/heads/master
+       if [ -z $(git ls-remote 2> /dev/null) ]; then
+               info "remote is empty, not merging anything"
+               exit
+       fi
        git fetch
        for object in $(git ls-tree -r origin/master | awk '{print $4}'); do
                [ -e "$object" ] &&
        git fetch
        for object in $(git ls-tree -r origin/master | awk '{print $4}'); do
                [ -e "$object" ] &&