From 98bb7fe95704b916e20b263c6f9664e277a79ad6 Mon Sep 17 00:00:00 2001 From: Daley Calvert <dcalve@users.noreply.github.com> Date: Wed, 14 Dec 2022 18:33:37 +0000 Subject: [PATCH] #133- Use a consistent determination for the git hash in SETTE --- sette/all_functions.sh | 2 +- sette/sette_eval.sh | 4 +--- sette/sette_rpt.sh | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index f75cfe3d..94822b6e 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -172,7 +172,7 @@ clean_config() { # define validation dir set_valid_dir () { if [ ${DETACHED_HEAD} == "no" ] ; then - REVISION_NB=`git -C ${MAIN_DIR} rev-list --abbrev-commit HEAD | head -1l` + REVISION_NB=`git -C ${MAIN_DIR} rev-parse --short HEAD` else REVISION_NB=${DETACHED_CMIT} fi diff --git a/sette/sette_eval.sh b/sette/sette_eval.sh index f46b4788..58263277 100755 --- a/sette/sette_eval.sh +++ b/sette/sette_eval.sh @@ -262,20 +262,18 @@ localchanges=`git status --short -uno | wc -l` git branch --show-current >& /dev/null if [[ $? == 0 ]] ; then branchname="$(git branch --show-current)" + revision=`git rev-parse --short HEAD` if [ -z $branchname ] ; then # Probabably on a detached HEAD (possibly testing an old commit). # Verify this and try to recover original commit MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )" if [[ "${MORE_INFO}" == *"detached"* ]] ; then - revision=$( echo \\${MORE_INFO} | awk '{print $NF}' ) # There is no robust way to recover a branch name in a detached state # so just use the commit with a prefix branchname="detached_"${revision} else branchname="Unknown" fi - else - revision=`git rev-list --abbrev-commit origin | head -1l` fi else branchname="Unknown" diff --git a/sette/sette_rpt.sh b/sette/sette_rpt.sh index 862257cc..ff7ebf8d 100755 --- a/sette/sette_rpt.sh +++ b/sette/sette_rpt.sh @@ -580,20 +580,18 @@ localchanges=`git status --short -uno | wc -l` git branch --show-current >& /dev/null if [[ $? == 0 ]] ; then branchname="$(git branch --show-current)" + revision=`git rev-parse --short HEAD` if [ -z $branchname ] ; then # Probabably on a detached HEAD (possibly testing an old commit). # Verify this and try to recover original commit MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )" if [[ "${MORE_INFO}" == *"detached"* ]] ; then - revision=$( echo \\${MORE_INFO} | awk '{print $NF}' ) # There is no robust way to recover a branch name in a detached state # so just use the commit with a prefix branchname="detached_"${revision} else branchname="Unknown" fi - else - revision=`git rev-list --abbrev-commit HEAD | head -1l` fi else branchname="Unknown" -- GitLab