diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-07-19 13:58:16 +0100 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2015-07-20 11:35:12 +0300 |
commit | 7a370df96646913d8a541df08376acb60e11930d (patch) | |
tree | 98a691ef97f6f73dea437718d9c1ed3957354460 /ezbench.sh | |
parent | c993c4a4445bddce57aaf2a3c6eec5e917405e9a (diff) |
Place the repo check before setting up the termination handler
If we don't have a git repository we exit early and have nothing to
restore.
Diffstat (limited to 'ezbench.sh')
-rwxr-xr-x | ezbench.sh | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -103,18 +103,6 @@ mkdir $logsFolder || exit 1 exec > >(tee $logsFolder/results) exec 2>&1 -# function to call on exit -function finish { - # to be executed on exit, possibly twice! - git reset --hard $commit_head 2> /dev/null - [ -n "$stash" ] && git stash apply $stash > /dev/null - - # Execute the user-defined post hook - callIfDefined ezbench_post_hook -} -trap finish EXIT -trap finish INT # Needed for zsh - # Check the git repo, saving then displaying the HEAD commit cd $gitRepoDir commit_head=$(git rev-parse HEAD 2>/dev/null) @@ -129,6 +117,18 @@ echo "Original commit = $commit_head" stash=`git stash create` [ -n "$stash" ] && echo "Preserving work-in-progress" +# function to call on exit +function finish { + # to be executed on exit, possibly twice! + git reset --hard $commit_head 2> /dev/null + [ -n "$stash" ] && git stash apply $stash > /dev/null + + # Execute the user-defined post hook + callIfDefined ezbench_post_hook +} +trap finish EXIT +trap finish INT # Needed for zsh + # Generate the actual list of tests typeset -A testNames typeset -A testPrevFps |