From 048f84237651b0980faba647e2d929fa1e270a82 Mon Sep 17 00:00:00 2001 From: William Hilton Date: Wed, 31 Aug 2022 16:38:31 -0400 Subject: [PATCH] handle default branch not being called 'master' --- bin/g | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/g b/bin/g index d783f56..f03f046 100755 --- a/bin/g +++ b/bin/g @@ -476,11 +476,14 @@ then url=${url%#*} fi -# Default to master branch if no branch in URL -clone_branch=${clone_branch:-master} - -echo "Cloning $clone_branch branch of $url" -git clone --recurse-submodules -b $clone_branch "$url" +# Clone specified branch, or default branch if not specified +if [ -z "$clone_branch" ]; then + echo "Cloning default branch of $url" + git clone --recurse-submodules "$url" +else + echo "Cloning $clone_branch branch of $url" + git clone --recurse-submodules -b "$clone_branch" "$url" +fi ;; squash)