Skip to content

Commit

Permalink
Use HOMESHICK_CLONE_BRANCH env var to clone specific branch
Browse files Browse the repository at this point in the history
  • Loading branch information
antontsv committed Aug 15, 2016
1 parent 723535f commit dc42a3f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/commands/clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ function clone {
local git_out
version_compare $GIT_VERSION 1.6.5
if [[ $? != 2 ]]; then
git_out=$(git clone --recursive "$git_repo" "$repo_path" 2>&1)
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)
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"
success

pending 'submodules' "$git_repo"
Expand Down

0 comments on commit dc42a3f

Please sign in to comment.