From: Richard Hartmann Date: Tue, 6 Dec 2011 20:54:35 +0000 (+0100) Subject: Make `vcsh clone` handle empty remotes gracefully X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/6f91211dc0410339d678e5489eb6fd14b4251c87?hp=8260b8ec02317989a83e44577d36b42c6276d732 Make `vcsh clone` handle empty remotes gracefully --- diff --git a/TODO b/TODO index 8f5b1bf..4cb6093 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -* vcsh clone fails when remote is empty - # Related # * Package for Debian diff --git a/vcsh b/vcsh index ec0301f..4979d71 100755 --- 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 + 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" ] &&