[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] automation: allow build-test.sh to run in detached HEAD state



commit f21a359a301d3a52c29452eaed7a964713ef48ea
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Feb 27 17:42:07 2019 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Apr 5 11:14:57 2019 +0100

    automation: allow build-test.sh to run in detached HEAD state
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 automation/scripts/build-test.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/automation/scripts/build-test.sh b/automation/scripts/build-test.sh
index c318b65d5a..206a4f9a4a 100755
--- a/automation/scripts/build-test.sh
+++ b/automation/scripts/build-test.sh
@@ -5,6 +5,9 @@
 #
 # The default rune is rather simple. To do a cross-build, please put your usual
 # build rune in a shell script and invoke it with this script.
+#
+# Set NON_SYMBOLIC_REF=1 if you want to use this script in detached HEAD state.
+# This is currently used by automated test system.
 
 if test $# -lt 2 ; then
     echo "Usage:"
@@ -25,10 +28,14 @@ fi
 BASE=$1; shift
 TIP=$1; shift
 
-ORIG_BRANCH=`git symbolic-ref -q --short HEAD`
-if test $? -ne 0; then
-    echo "Detached HEAD, aborted"
-    exit 1
+if [[ "_${NON_SYMBOLIC_REF}" != "_1" ]]; then
+    ORIG=`git symbolic-ref -q --short HEAD`
+    if test $? -ne 0; then
+        echo "Detached HEAD, aborted"
+        exit 1
+    fi
+else
+    ORIG=`git rev-parse HEAD`
 fi
 
 while read num rev; do
@@ -55,7 +62,7 @@ while read num rev; do
 done < <(git rev-list $BASE..$TIP | nl -ba | tac)
 
 echo "Restoring original HEAD"
-git checkout $ORIG_BRANCH
+git checkout $ORIG
 gco_ret=$?
 if test $gco_ret -ne 0; then
     echo "Failed to restore orignal HEAD. Check tree status before doing 
anything else!"
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.