Skip to content

Commit

Permalink
Ensure default branch is used unless specified
Browse files Browse the repository at this point in the history
Was causing dependency installs to break since no ref was supplied

Fix #88
  • Loading branch information
molovo committed Nov 17, 2017
1 parent fb4c5d7 commit b91f492
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/commands/install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function _zulu_install_package() {

# Get the repository URL from the JSON
repo=$(jsonval $json 'repository')

if [[ $? -ne 0 || -z $repo ]]; then
builtin echo 'Could not find repository URL' >&2
return 1
Expand All @@ -60,7 +61,11 @@ function _zulu_install_package() {
# Clone the repository
builtin cd "$base/packages"

command git clone --recursive --branch $ref $repo $package 2>&1
local -a args
if [[ -n $ref ]]; then
args=(--branch $ref)
fi
command git clone --recursive $args $repo $package 2>&1
if [[ $? -ne 0 ]]; then
builtin echo 'Failed to clone repository' >&2
return 1
Expand Down Expand Up @@ -156,7 +161,7 @@ function _zulu_install() {
fi
fi

local ref='master'
local ref=''
if [[ -n $branch ]]; then
builtin shift branch
ref=$branch
Expand Down

0 comments on commit b91f492

Please sign in to comment.