Skip to content
Snippets Groups Projects
Commit 21030a7f authored by Dridi Boukelmoune's avatar Dridi Boukelmoune
Browse files

vcsh: Create the local branch during clone

This will create and checkout a local branch named after the upstream
branch. It will also gracefully behave for the default `master' branch
and consistently show the same message:

Switched to a new branch '$VCSH_BRANCH'
parent a171b8ba
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,7 @@ clone() { ...@@ -148,6 +148,7 @@ clone() {
git remote add origin "$GIT_REMOTE" git remote add origin "$GIT_REMOTE"
git config branch."$VCSH_BRANCH".remote origin git config branch."$VCSH_BRANCH".remote origin
git config branch."$VCSH_BRANCH".merge refs/heads/"$VCSH_BRANCH" git config branch."$VCSH_BRANCH".merge refs/heads/"$VCSH_BRANCH"
git checkout -b $VCSH_BRANCH
if [ $(git ls-remote origin "$VCSH_BRANCH" 2> /dev/null | wc -l ) -lt 1 ]; then if [ $(git ls-remote origin "$VCSH_BRANCH" 2> /dev/null | wc -l ) -lt 1 ]; then
info "remote is empty, not merging anything" info "remote is empty, not merging anything"
exit exit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment