[tor-commits] [tor/master] scripts: Change to the top source directory as needed

teor at torproject.org teor at torproject.org
Mon Oct 28 03:30:58 UTC 2019


commit 3479024cb1034dd453fed577b493cbe5515765d3
Author: teor <teor at torproject.org>
Date:   Mon Oct 28 13:28:50 2019 +1000

    scripts: Change to the top source directory as needed
    
    Bugfix on 31919; not in any released version of tor.
---
 scripts/coccinelle/check_cocci_parse.sh | 1 +
 scripts/git/pre-push.git-hook           | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/coccinelle/check_cocci_parse.sh b/scripts/coccinelle/check_cocci_parse.sh
index 5c27c7bc8..220b40594 100755
--- a/scripts/coccinelle/check_cocci_parse.sh
+++ b/scripts/coccinelle/check_cocci_parse.sh
@@ -30,6 +30,7 @@ if test $# -ge 1 ; then
   "$try_parse" "$@"
   exitcode=$?
 else
+  cd "$top" || exit 1
   # This is the layout in 0.3.5
   "$try_parse" \
     src/lib/*/*.[ch] \
diff --git a/scripts/git/pre-push.git-hook b/scripts/git/pre-push.git-hook
index 2f3608029..7be184ec6 100755
--- a/scripts/git/pre-push.git-hook
+++ b/scripts/git/pre-push.git-hook
@@ -28,6 +28,8 @@ upstream_name=${TOR_UPSTREAM_REMOTE_NAME:-"upstream"}
 
 workdir=$(git rev-parse --show-toplevel)
 
+cd "$workdir" || exit 1
+
 remote="$1"
 remote_name=$(git remote --verbose | grep "$2" | awk '{print $1}' | head -n 1)
 
@@ -83,7 +85,7 @@ do
 
         # We want word splitting here, because file names are space separated
         # shellcheck disable=SC2086
-        if ! "$workdir/"scripts/git/pre-commit.git-hook $CHECK_FILES; then
+        if ! scripts/git/pre-commit.git-hook $CHECK_FILES ; then
             exit 1
         fi
 



More information about the tor-commits mailing list