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
0c16ec4c
Commit
0c16ec4c
authored
5 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug30286_2_squashed'
parents
8cb6b2b9
e8aab46a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/bug30286
+4
-0
4 additions, 0 deletions
changes/bug30286
scripts/git/pre-push.git-hook
+23
-10
23 additions, 10 deletions
scripts/git/pre-push.git-hook
with
27 additions
and
10 deletions
changes/bug30286
0 → 100644
+
4
−
0
View file @
0c16ec4c
o Minor bugfixes (developer tooling):
- Fix pre-push hook to refrain from rejecting fixup and squash commits
when pushing to non-upstream git remote. Fixes bug 30286; bugfix on
0.4.0.1-alpha.
This diff is collapsed.
Click to expand it.
scripts/git/pre-push.git-hook
+
23
−
10
View file @
0c16ec4c
...
...
@@ -8,6 +8,9 @@
#
# 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.
# Furthermore, make sure that TOR_UPSTREAM_REMOTE_NAME environment
# variable is set to local name of git remote that corresponds to upstream
# repository on e.g. git.torproject.org.
#
# The following sample script was used as starting point:
# https://github.com/git/git/blob/master/templates/hooks--pre-push.sample
...
...
@@ -16,16 +19,7 @@ echo "Running pre-push hook"
z40
=
0000000000000000000000000000000000000000
remote
=
"
$1
"
ref_is_upstream_branch
()
{
if
[
"
$1
"
==
"refs/heads/master"
]
||
[[
"
$1
"
==
refs/heads/release-
*
]]
||
[[
"
$1
"
==
refs/heads/maint-
*
]]
then
return
1
fi
}
upstream_name
=
${
TOR_UPSTREAM_REMOTE_NAME
:-
"upstream"
}
workdir
=
$(
git rev-parse
--show-toplevel
)
if
[
-x
"
$workdir
/.git/hooks/pre-commit"
]
;
then
...
...
@@ -40,6 +34,25 @@ if [ -e scripts/maint/practracker/practracker.py ]; then
fi
fi
remote
=
"
$1
"
remote_loc
=
"
$2
"
remote_name
=
$(
git remote
--verbose
|
grep
"
$2
"
|
awk
'{print $1}'
|
head
-n
1
)
if
[[
"
$remote_name
"
!=
"
$upstream_name
"
]]
;
then
echo
"Not pushing to upstream - refraining from further checks"
exit
0
fi
ref_is_upstream_branch
()
{
if
[
"
$1
"
==
"refs/heads/master"
]
||
[[
"
$1
"
==
refs/heads/release-
*
]]
||
[[
"
$1
"
==
refs/heads/maint-
*
]]
then
return
1
fi
}
# shellcheck disable=SC2034
while
read
-r
local_ref local_sha remote_ref remote_sha
do
...
...
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