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

[Xen-devel] [PATCH for-next 1/5] automation: allow build-test.sh to run in detached HEAD state



Signed-off-by: Wei Liu <wei.liu2@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!"
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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