[LyX/master] lyxbuild: factor out function to reset commit

Scott Kostyshak <[email protected]> Wed, 01 Jul 2026 12:59:43 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 518aa7804ea62bd27975f062639cd31eb4e62432
Author: Scott Kostyshak <[email protected]>
Date:   Wed Jul 1 14:31:45 2026 +0200

    lyxbuild: factor out function to reset commit
    
    I will use this code (in future commits) in other places where it is
    useful to reset the commit after a failure, such as a failure after
    a cmake call or after a reconfigure.
    
    No change in functionality expected.
---
 development/lyx-tester/lyxbuild | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/development/lyx-tester/lyxbuild b/development/lyx-tester/lyxbuild
index 7685acb5aa..ef0e9586f8 100755
--- a/development/lyx-tester/lyxbuild
+++ b/development/lyx-tester/lyxbuild
@@ -103,6 +103,15 @@ function WARNINGPREFIX() {
   echo "$(ECHOPREFIX)WARNING: "
 }
 
+function if_bisect_restore_commit() {
+  if [[ "${bisect}" == "1" && "${patch_old}" == "1" ]]; then
+    echo "$(ECHOPREFIX)checking out original bisect commit, before patches..."
+    echo "CD TO: ${gitRepoDIR}"
+    cd "${gitRepoDIR}"
+    git reset --hard
+    git checkout "${hash_orig}"
+  fi
+}
 
 ARGS=$( getopt -o "j:ahr:vu:p:q:fogx" -l "jobs:,automake,help,profile:,version,user-dir:,patches-dir:,qt-build-dir:,qt5,patch-old,gcc,enable-export-tests" \
       -n "$( basename "$0" )" -- "$@" )
@@ -1093,11 +1102,6 @@ cp -r "${LYX_USER_DIR}" "${LYX_USER_DIR_NOAUTH}"
 echo "\\use_converter_needauth false" >> "${LYX_USER_DIR_NOAUTH}"/preferences
 
 cd "${gitRepoDIR}"
-if [ "${bisect}" = "1" ] && [ "${patch_old}" = "1" ]; then
-  # restore so that "git bisect good/bad" works.
-  echo "$(ECHOPREFIX)checking out original bisect commit, before patches..."
-  git reset --hard
-  git checkout "${hash_orig}"
-fi
+if_bisect_restore_commit
 
 echo "$(ECHOPREFIX)done."
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs