Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
eff95429
Commit
eff95429
authored
5 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-github/pr/1241'
parents
24bc2cd7
bdcccb97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
changes/bug31462
+4
-0
4 additions, 0 deletions
changes/bug31462
changes/ticket30979
+5
-3
5 additions, 3 deletions
changes/ticket30979
scripts/git/pre-commit.git-hook
+13
-3
13 additions, 3 deletions
scripts/git/pre-commit.git-hook
scripts/git/pre-push.git-hook
+7
-11
7 additions, 11 deletions
scripts/git/pre-push.git-hook
with
29 additions
and
17 deletions
changes/bug31462
0 → 100644
+
4
−
0
View file @
eff95429
o Minor bugfixes (git hooks):
- Remove a duplicate call to practracker from the pre-push hook.
The pre-push hook already calls the pre-commit hook, which calls
practracker. Fixes bug 31462; bugfix on 0.4.1.1-alpha.
This diff is collapsed.
Click to expand it.
changes/ticket30979
+
5
−
3
View file @
eff95429
o Minor features (git hooks):
- Our pre-push git hook now checks for a special file
before running practracker, so that it only runs on branches
that are based on master.
- Our pre-commit git hook now checks for a special file
before running practracker, so that practracker only runs on branches
that are based on master. Since the pre-push hook calls the pre-commit
hook, practracker will also only run before pushes of branches based
on master.
Closes ticket 30979.
This diff is collapsed.
Click to expand it.
scripts/git/pre-commit.git-hook
+
13
−
3
View file @
eff95429
...
...
@@ -4,7 +4,8 @@
# tor git repo and make sure it has permission to execute.
#
# This is pre-commit git hook script that prevents commiting your changeset if
# it fails our code formatting or changelog entry formatting checkers.
# it fails our code formatting, changelog entry formatting, module include
# rules, or best practices tracker.
workdir
=
$(
git rev-parse
--show-toplevel
)
...
...
@@ -40,6 +41,15 @@ if test -e scripts/maint/practracker/includes.py; then
python scripts/maint/practracker/includes.py
fi
if
[
-e
scripts/maint/practracker/practracker.py
]
;
then
python3 ./scripts/maint/practracker/practracker.py
"
$workdir
"
# Only call practracker if ${PT_DIR}/.enable_practracker_in_hooks exists
# We do this check so that we can enable practracker in hooks in master, and
# disable it on maint branches
PT_DIR
=
scripts/maint/practracker
if
[
-e
"
${
PT_DIR
}
/practracker.py"
]
;
then
if
[
-e
"
${
PT_DIR
}
/.enable_practracker_in_hooks"
]
;
then
if
!
python3
"
${
PT_DIR
}
/practracker.py"
"
$workdir
"
;
then
exit
1
fi
fi
fi
This diff is collapsed.
Click to expand it.
scripts/git/pre-push.git-hook
+
7
−
11
View file @
eff95429
#!/usr/bin/env bash
# git pre-push hook script to:
# 0) Call the pre-commit hook, if it is available
# 1) prevent "fixup!" and "squash!" commit from ending up in master, release-*
# or maint-*
# 2) Disallow pushing branches other than master, release-*
# and maint-* to origin (e.g. gitweb.torproject.org)
.
# and maint-* to origin (e.g. gitweb.torproject.org)
#
# To install this script, copy it into .git/hooks/pre-push path in your
# local copy of git repository. Make sure it has permission to execute.
...
...
@@ -21,6 +22,11 @@ z40=0000000000000000000000000000000000000000
upstream_name
=
${
TOR_UPSTREAM_REMOTE_NAME
:-
"upstream"
}
# Are you adding a new check to the git hooks?
# - Common checks belong in the pre-commit hook
# - Push-only checks belong in the pre-push hook
#
# Call the pre-commit hook for the common checks, if it is executable.
workdir
=
$(
git rev-parse
--show-toplevel
)
if
[
-x
"
$workdir
/.git/hooks/pre-commit"
]
;
then
if
!
"
$workdir
"
/.git/hooks/pre-commit
;
then
...
...
@@ -28,16 +34,6 @@ if [ -x "$workdir/.git/hooks/pre-commit" ]; then
fi
fi
PT_DIR
=
scripts/maint/practracker
if
[
-e
"
${
PT_DIR
}
/practracker.py"
]
;
then
if
[
-e
"
${
PT_DIR
}
/.enable_practracker_in_hooks"
]
;
then
if
!
python3
"
${
PT_DIR
}
/practracker.py"
"
$workdir
"
;
then
exit
1
fi
fi
fi
remote
=
"
$1
"
remote_name
=
$(
git remote
--verbose
|
grep
"
$2
"
|
awk
'{print $1}'
|
head
-n
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment