From 6f91211dc0410339d678e5489eb6fd14b4251c87 Mon Sep 17 00:00:00 2001 From: Richard Hartmann Date: Tue, 6 Dec 2011 21:54:35 +0100 Subject: [PATCH] Make `vcsh clone` handle empty remotes gracefully --- TODO | 2 -- vcsh | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) 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" ] && -- 2.39.2