summaryrefslogtreecommitdiff
path: root/setup_environment
diff options
context:
space:
mode:
authortgrogers <[email protected]>2018-06-30 10:17:18 -0400
committertgrogers <[email protected]>2018-06-30 10:17:18 -0400
commit263fd9540b90be452640b54c19c7403c2281f3d9 (patch)
tree3d7ecebcb7b162fa6b79710d8b60f2e00eba9c6a /setup_environment
parent691c57ea8596da35da3ce90a7b58796f3791036c (diff)
Preventing bad git commit numbers from printing when you run setup_env from a dir that is not the gpgpusim_distr dir
Diffstat (limited to 'setup_environment')
-rw-r--r--setup_environment3
1 files changed, 3 insertions, 0 deletions
diff --git a/setup_environment b/setup_environment
index e5cd4fa..65f8340 100644
--- a/setup_environment
+++ b/setup_environment
@@ -7,10 +7,13 @@ export GPGPUSIM_ROOT="$( cd "$( dirname "$BASH_SOURCE" )" && pwd )"
GPGPUSIM_VERSION_STRING=`cat $GPGPUSIM_ROOT/version | awk '/Version/ {print $8}'`
#Detect Git branch and commit #
+CURRENT_PWD=`pwd`
+cd $GPGPUSIM_ROOT
GIT_COMMIT=`git log -n 1 | head -1 | sed -re 's/commit (.*)/\1/'`
GIT_FILES_CHANGED=`git diff --numstat | wc | sed -re 's/^\s+([0-9]+).*/\1./'`
GIT_FILES_CHANGED+=`git diff --numstat --cached | wc | sed -re 's/^\s+([0-9]+).*/\1/'`
GPGPUSIM_BUILD_STRING="gpgpu-sim_git-commit-$GIT_COMMIT-modified_$GIT_FILES_CHANGED"
+cd $CURRENT_PWD
echo -n "GPGPU-Sim version $GPGPUSIM_VERSION_STRING (build $GPGPUSIM_BUILD_STRING) ";