diff --git a/lib/commands/clone.sh b/lib/commands/clone.sh index 1eaea39f..bbd28e55 100644 --- a/lib/commands/clone.sh +++ b/lib/commands/clone.sh @@ -23,15 +23,17 @@ function clone { if [ -n "$HOMESHICK_CLONE_BRANCH" ];then git_out=$(git clone -b "$HOMESHICK_CLONE_BRANCH" --recursive "$git_repo" "$repo_path" 2>&1) else - git_out=$(git clone $clone_branch_param --recursive "$git_repo" "$repo_path" 2>&1) + git_out=$(git clone --recursive "$git_repo" "$repo_path" 2>&1) fi; [[ $? == 0 ]] || err $EX_SOFTWARE "Unable to clone $git_repo. Git says:" "$git_out" success else git_out=$(git clone "$git_repo" "$repo_path" 2>&1) [[ $? == 0 ]] || err $EX_SOFTWARE "Unable to clone $git_repo. Git says:" "$git_out" - git_out=$(git branch "$HOMESHICK_CLONE_BRANCH" "origin/$HOMESHICK_CLONE_BRANCH" && git checkout "$HOMESHICK_CLONE_BRANCH") - [[ $? == 0 ]] || err $EX_SOFTWARE "Cannot checkout branch '$HOMESHICK_CLONE_BRANCH' for $git_repo. Git says:" "$git_out" + if [ -n "$HOMESHICK_CLONE_BRANCH" ];then + git_out=$(git branch "$HOMESHICK_CLONE_BRANCH" "origin/$HOMESHICK_CLONE_BRANCH" && git checkout "$HOMESHICK_CLONE_BRANCH") + [[ $? == 0 ]] || err $EX_SOFTWARE "Cannot checkout branch '$HOMESHICK_CLONE_BRANCH' for $git_repo. Git says:" "$git_out" + fi; success pending 'submodules' "$git_repo"