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() {
# 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
......
......@@ -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"
......
......@@ -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"
......
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