Skip to content

Commit

Permalink
init: Pass --branch to git clone command
Browse files Browse the repository at this point in the history
In the case where submodules are only on a branch, then
the initial clone won't get them.  We were only not using `--branch`
because of RHEL7 support, which we no longer care about.  Pass
`--branch` to the initial `git clone` so it's cleaner, and we handle
submodules correctly.
  • Loading branch information
cgwalters authored and jlebon committed Nov 4, 2019
1 parent 043d4be commit d09ba0f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/cmd-init
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ mkdir -p src
if ! test -e config; then
case "${source}" in
/*) ln -s "${source}/${subdir}" config;;
*) git clone --recurse-submodules "${source}" config
if [ -n "${BRANCH}" ]; then
git -C config checkout "${BRANCH}"
fi
*) git clone ${BRANCH:+--branch=${BRANCH}} --recurse-submodules "${source}" config
if [ -n "${subdir}" ]; then
mv config config-git
ln -sr config-git/"${subdir}" config
Expand Down

0 comments on commit d09ba0f

Please sign in to comment.