From f900bd79463821c8f5a677c566f9af053d81a860 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Wed, 5 Sep 2012 17:23:14 -0400 Subject: [PATCH] Add git_update_remote_branch to functions. When $RECLONE=yes, and the branch specified for a project in stackrc is a remote branch, the git_clone function would not recognize it as a branch. git_clone now attempts to recognize a remote branch and handle it appropriately. Change-Id: Ie23ff12eb5a7905088a9c2bb0ea2b02453ec0258 --- AUTHORS | 1 + functions | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 4f771ce179..22d5f32b33 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ Aaron Lee Aaron Rosen Adam Gandelman +Andrew Laski Andy Smith Anthony Young Armando Migliaccio diff --git a/functions b/functions index af154b0cfa..5fdae26a42 100644 --- a/functions +++ b/functions @@ -278,6 +278,16 @@ function git_update_tag() { } +# git update using reference as a branch. +# git_update_remote_branch ref +function git_update_remote_branch() { + + GIT_BRANCH=$1 + + git checkout -b $GIT_BRANCH -t origin/$GIT_BRANCH +} + + # Translate the OS version values into common nomenclature # Sets ``DISTRO`` from the ``os_*`` values function GetDistro() { @@ -343,6 +353,8 @@ function git_clone { git_update_tag $GIT_REF elif [[ -n "`git show-ref refs/heads/$GIT_REF`" ]]; then git_update_branch $GIT_REF + elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then + git_update_remote_branch $GIT_REF else echo $GIT_REF is neither branch nor tag exit 1 @@ -770,4 +782,4 @@ $XTRACE # Local variables: # -*- mode: Shell-script -*- -# End: \ No newline at end of file +# End: