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
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
Aaron Lee <aaron.lee@rackspace.com> |
| 2 | 2 |
Aaron Rosen <arosen@nicira.com> |
| 3 | 3 |
Adam Gandelman <adamg@canonical.com> |
| 4 |
+Andrew Laski <andrew.laski@rackspace.com> |
|
| 4 | 5 |
Andy Smith <github@anarkystic.com> |
| 5 | 6 |
Anthony Young <sleepsonthefloor@gmail.com> |
| 6 | 7 |
Armando Migliaccio <armando.migliaccio@eu.citrix.com> |
| ... | ... |
@@ -278,6 +278,16 @@ function git_update_tag() {
|
| 278 | 278 |
} |
| 279 | 279 |
|
| 280 | 280 |
|
| 281 |
+# git update using reference as a branch. |
|
| 282 |
+# git_update_remote_branch ref |
|
| 283 |
+function git_update_remote_branch() {
|
|
| 284 |
+ |
|
| 285 |
+ GIT_BRANCH=$1 |
|
| 286 |
+ |
|
| 287 |
+ git checkout -b $GIT_BRANCH -t origin/$GIT_BRANCH |
|
| 288 |
+} |
|
| 289 |
+ |
|
| 290 |
+ |
|
| 281 | 291 |
# Translate the OS version values into common nomenclature |
| 282 | 292 |
# Sets ``DISTRO`` from the ``os_*`` values |
| 283 | 293 |
function GetDistro() {
|
| ... | ... |
@@ -343,6 +353,8 @@ function git_clone {
|
| 343 | 343 |
git_update_tag $GIT_REF |
| 344 | 344 |
elif [[ -n "`git show-ref refs/heads/$GIT_REF`" ]]; then |
| 345 | 345 |
git_update_branch $GIT_REF |
| 346 |
+ elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then |
|
| 347 |
+ git_update_remote_branch $GIT_REF |
|
| 346 | 348 |
else |
| 347 | 349 |
echo $GIT_REF is neither branch nor tag |
| 348 | 350 |
exit 1 |
| ... | ... |
@@ -770,4 +782,4 @@ $XTRACE |
| 770 | 770 |
|
| 771 | 771 |
# Local variables: |
| 772 | 772 |
# -*- mode: Shell-script -*- |
| 773 |
-# End: |
|
| 774 | 773 |
\ No newline at end of file |
| 774 |
+# End: |