aboutsummaryrefslogtreecommitdiff
path: root/scripts/git
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-10-31 14:51:31 +1000
committerteor <teor@torproject.org>2019-10-31 14:51:31 +1000
commite046903f9360b0b0553a4e281fd1104eab4df93b (patch)
tree2022fabfcca2d4c8ef227f7316bfba2eb7dd12b7 /scripts/git
parent7e73c0d5a1f87d610e8348a5cbc25ca1bbc85b35 (diff)
downloadtor-e046903f9360b0b0553a4e281fd1104eab4df93b.tar.gz
tor-e046903f9360b0b0553a4e281fd1104eab4df93b.zip
scripts/git: Restore a dropped check for pre-commit in pre-push
Bugfix on 31919; not in any released version of Tor.
Diffstat (limited to 'scripts/git')
-rwxr-xr-xscripts/git/pre-push.git-hook60
1 files changed, 32 insertions, 28 deletions
diff --git a/scripts/git/pre-push.git-hook b/scripts/git/pre-push.git-hook
index 7be184ec6e..6a85e951a8 100755
--- a/scripts/git/pre-push.git-hook
+++ b/scripts/git/pre-push.git-hook
@@ -58,35 +58,39 @@ do
fi
# Call the pre-commit hook for the common checks, if it is executable
- # Only check the files newly modified in this branch
- CHECK_FILTER="git diff --name-only --diff-filter=ACMR $range"
- # Use the appropriate owned tor source list to filter the changed files
- if [ -d src/lib ]; then
- # This is the layout in 0.3.5
- CHECK_FILES="$($CHECK_FILTER \
- src/lib/*/*.[ch] \
- src/core/*/*.[ch] \
- src/feature/*/*.[ch] \
- src/app/*/*.[ch] \
- src/test/*.[ch] \
- src/test/*/*.[ch] \
- src/tools/*.[ch] \
- )"
- elif [ -d src/common ]; then
- # This was the layout before 0.3.5
- CHECK_FILES="$($CHECK_FILTER \
- src/common/*/*.[ch] \
- src/or/*/*.[ch] \
- src/test/*.[ch] \
- src/test/*/*.[ch] \
- src/tools/*.[ch]
- )"
- fi
+ if [ -x scripts/git/pre-commit.git-hook ]; then
+ # Only check the files newly modified in this branch
+ CHECK_FILTER="git diff --name-only --diff-filter=ACMR $range"
+ # Use the appropriate owned tor source list to filter the changed
+ # files
+ if [ -d src/lib ]; then
+ # This is the layout in 0.3.5
+ CHECK_FILES="$($CHECK_FILTER \
+ src/lib/*/*.[ch] \
+ src/core/*/*.[ch] \
+ src/feature/*/*.[ch] \
+ src/app/*/*.[ch] \
+ src/test/*.[ch] \
+ src/test/*/*.[ch] \
+ src/tools/*.[ch] \
+ )"
+ elif [ -d src/common ]; then
+ # This was the layout before 0.3.5
+ CHECK_FILES="$($CHECK_FILTER \
+ src/common/*/*.[ch] \
+ src/or/*/*.[ch] \
+ src/test/*.[ch] \
+ src/test/*/*.[ch] \
+ src/tools/*.[ch]
+ )"
+ fi
- # We want word splitting here, because file names are space separated
- # shellcheck disable=SC2086
- if ! scripts/git/pre-commit.git-hook $CHECK_FILES ; then
- exit 1
+ # We want word splitting here, because file names are space
+ # separated
+ # shellcheck disable=SC2086
+ if ! scripts/git/pre-commit.git-hook $CHECK_FILES ; then
+ exit 1
+ fi
fi
if [[ "$remote_name" != "$upstream_name" ]]; then