Last change
on this file since 2559 was
2539,
checked in by broder, 15 years ago
|
Disallow pushing to submodule branches that are tracking branches for
pockets.
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | |
---|
3 | ref="$1" |
---|
4 | oldrev="$2" |
---|
5 | newrev="$3" |
---|
6 | |
---|
7 | # --- Safety check |
---|
8 | |
---|
9 | if [ -z "$GIT_DIR" ]; then |
---|
10 | echo "Don't run this script from the command line." >&2 |
---|
11 | echo " (if you want, you could supply GIT_DIR then run" >&2 |
---|
12 | echo " $0 <ref> <oldrev> <newrev>)" >&2 |
---|
13 | exit 1 |
---|
14 | fi |
---|
15 | |
---|
16 | if [ -z "$ref" -o -z "$oldrev" -o -z "$newrev" ]; then |
---|
17 | echo "Usage: $0 <ref> <oldrev> <newrev>" >&2 |
---|
18 | exit 1 |
---|
19 | fi |
---|
20 | |
---|
21 | # --- Disallow pushing to the branches for pockets |
---|
22 | |
---|
23 | pocket_to_git() { |
---|
24 | local pocket git |
---|
25 | pocket="$1" |
---|
26 | git="$(invirt-getconf "git.pockets.$pocket.git" 2>/dev/null)" |
---|
27 | if [ $? != 0 ]; then |
---|
28 | git="$pocket" |
---|
29 | fi |
---|
30 | echo "$git" |
---|
31 | } |
---|
32 | |
---|
33 | for pocket in $(invirt-getconf -l git.pockets); do |
---|
34 | if [ "$ref" = "refs/heads/$(pocket_to_git "$pocket")" ]; then |
---|
35 | echo "*** Pushing to a pocket branch in this repository is not allowed" >&2 |
---|
36 | exit 1 |
---|
37 | fi |
---|
38 | done |
---|
39 | |
---|
40 | # --- Disallow pushing tags |
---|
41 | |
---|
42 | case "$ref" in |
---|
43 | refs/heads/*) |
---|
44 | ;; |
---|
45 | *) |
---|
46 | echo "*** Pushing non-branches to this repository is not allowed" >&2 |
---|
47 | exit 1 |
---|
48 | ;; |
---|
49 | esac |
---|
Note: See
TracBrowser
for help on using the repository browser.