Skip to content
Snippets Groups Projects
Commit 98bb7fe9 authored by Daley Calvert's avatar Daley Calvert
Browse files

#133- Use a consistent determination for the git hash in SETTE

parent 523d2737
No related branches found
No related tags found
No related merge requests found
...@@ -172,7 +172,7 @@ clean_config() { ...@@ -172,7 +172,7 @@ clean_config() {
# define validation dir # define validation dir
set_valid_dir () { set_valid_dir () {
if [ ${DETACHED_HEAD} == "no" ] ; then 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 else
REVISION_NB=${DETACHED_CMIT} REVISION_NB=${DETACHED_CMIT}
fi fi
......
...@@ -262,20 +262,18 @@ localchanges=`git status --short -uno | wc -l` ...@@ -262,20 +262,18 @@ localchanges=`git status --short -uno | wc -l`
git branch --show-current >& /dev/null git branch --show-current >& /dev/null
if [[ $? == 0 ]] ; then if [[ $? == 0 ]] ; then
branchname="$(git branch --show-current)" branchname="$(git branch --show-current)"
revision=`git rev-parse --short HEAD`
if [ -z $branchname ] ; then if [ -z $branchname ] ; then
# Probabably on a detached HEAD (possibly testing an old commit). # Probabably on a detached HEAD (possibly testing an old commit).
# Verify this and try to recover original commit # Verify this and try to recover original commit
MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )" MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )"
if [[ "${MORE_INFO}" == *"detached"* ]] ; then 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 # There is no robust way to recover a branch name in a detached state
# so just use the commit with a prefix # so just use the commit with a prefix
branchname="detached_"${revision} branchname="detached_"${revision}
else else
branchname="Unknown" branchname="Unknown"
fi fi
else
revision=`git rev-list --abbrev-commit origin | head -1l`
fi fi
else else
branchname="Unknown" branchname="Unknown"
......
...@@ -580,20 +580,18 @@ localchanges=`git status --short -uno | wc -l` ...@@ -580,20 +580,18 @@ localchanges=`git status --short -uno | wc -l`
git branch --show-current >& /dev/null git branch --show-current >& /dev/null
if [[ $? == 0 ]] ; then if [[ $? == 0 ]] ; then
branchname="$(git branch --show-current)" branchname="$(git branch --show-current)"
revision=`git rev-parse --short HEAD`
if [ -z $branchname ] ; then if [ -z $branchname ] ; then
# Probabably on a detached HEAD (possibly testing an old commit). # Probabably on a detached HEAD (possibly testing an old commit).
# Verify this and try to recover original commit # Verify this and try to recover original commit
MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )" MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )"
if [[ "${MORE_INFO}" == *"detached"* ]] ; then 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 # There is no robust way to recover a branch name in a detached state
# so just use the commit with a prefix # so just use the commit with a prefix
branchname="detached_"${revision} branchname="detached_"${revision}
else else
branchname="Unknown" branchname="Unknown"
fi fi
else
revision=`git rev-list --abbrev-commit HEAD | head -1l`
fi fi
else else
branchname="Unknown" branchname="Unknown"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment