Manos Chorianopoulos

version 2.2.0 - SPM Implementation

Showing 1000 changed files with 1891 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +[core]
2 + repositoryformatversion = 0
3 + filemode = true
4 + bare = true
5 + ignorecase = true
6 + precomposeunicode = true
7 +[remote "origin"]
8 + url = https://github.com/yeahdongcn/RSBarcodes_Swift
9 + fetch = +refs/*:refs/*
10 + mirror = true
1 +Unnamed repository; edit this file 'description' to name the repository.
1 +#!/bin/sh
2 +#
3 +# An example hook script to check the commit log message taken by
4 +# applypatch from an e-mail message.
5 +#
6 +# The hook should exit with non-zero status after issuing an
7 +# appropriate message if it wants to stop the commit. The hook is
8 +# allowed to edit the commit message file.
9 +#
10 +# To enable this hook, rename this file to "applypatch-msg".
11 +
12 +. git-sh-setup
13 +commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
14 +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
15 +:
1 +#!/bin/sh
2 +#
3 +# An example hook script to check the commit log message.
4 +# Called by "git commit" with one argument, the name of the file
5 +# that has the commit message. The hook should exit with non-zero
6 +# status after issuing an appropriate message if it wants to stop the
7 +# commit. The hook is allowed to edit the commit message file.
8 +#
9 +# To enable this hook, rename this file to "commit-msg".
10 +
11 +# Uncomment the below to add a Signed-off-by line to the message.
12 +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13 +# hook is more suited to it.
14 +#
15 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17 +
18 +# This example catches duplicate Signed-off-by lines.
19 +
20 +test "" = "$(grep '^Signed-off-by: ' "$1" |
21 + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22 + echo >&2 Duplicate Signed-off-by lines.
23 + exit 1
24 +}
1 +#!/usr/bin/perl
2 +
3 +use strict;
4 +use warnings;
5 +use IPC::Open2;
6 +
7 +# An example hook script to integrate Watchman
8 +# (https://facebook.github.io/watchman/) with git to speed up detecting
9 +# new and modified files.
10 +#
11 +# The hook is passed a version (currently 2) and last update token
12 +# formatted as a string and outputs to stdout a new update token and
13 +# all files that have been modified since the update token. Paths must
14 +# be relative to the root of the working tree and separated by a single NUL.
15 +#
16 +# To enable this hook, rename this file to "query-watchman" and set
17 +# 'git config core.fsmonitor .git/hooks/query-watchman'
18 +#
19 +my ($version, $last_update_token) = @ARGV;
20 +
21 +# Uncomment for debugging
22 +# print STDERR "$0 $version $last_update_token\n";
23 +
24 +# Check the hook interface version
25 +if ($version ne 2) {
26 + die "Unsupported query-fsmonitor hook version '$version'.\n" .
27 + "Falling back to scanning...\n";
28 +}
29 +
30 +my $git_work_tree = get_working_dir();
31 +
32 +my $retry = 1;
33 +
34 +my $json_pkg;
35 +eval {
36 + require JSON::XS;
37 + $json_pkg = "JSON::XS";
38 + 1;
39 +} or do {
40 + require JSON::PP;
41 + $json_pkg = "JSON::PP";
42 +};
43 +
44 +launch_watchman();
45 +
46 +sub launch_watchman {
47 + my $o = watchman_query();
48 + if (is_work_tree_watched($o)) {
49 + output_result($o->{clock}, @{$o->{files}});
50 + }
51 +}
52 +
53 +sub output_result {
54 + my ($clockid, @files) = @_;
55 +
56 + # Uncomment for debugging watchman output
57 + # open (my $fh, ">", ".git/watchman-output.out");
58 + # binmode $fh, ":utf8";
59 + # print $fh "$clockid\n@files\n";
60 + # close $fh;
61 +
62 + binmode STDOUT, ":utf8";
63 + print $clockid;
64 + print "\0";
65 + local $, = "\0";
66 + print @files;
67 +}
68 +
69 +sub watchman_clock {
70 + my $response = qx/watchman clock "$git_work_tree"/;
71 + die "Failed to get clock id on '$git_work_tree'.\n" .
72 + "Falling back to scanning...\n" if $? != 0;
73 +
74 + return $json_pkg->new->utf8->decode($response);
75 +}
76 +
77 +sub watchman_query {
78 + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
79 + or die "open2() failed: $!\n" .
80 + "Falling back to scanning...\n";
81 +
82 + # In the query expression below we're asking for names of files that
83 + # changed since $last_update_token but not from the .git folder.
84 + #
85 + # To accomplish this, we're using the "since" generator to use the
86 + # recency index to select candidate nodes and "fields" to limit the
87 + # output to file names only. Then we're using the "expression" term to
88 + # further constrain the results.
89 + my $last_update_line = "";
90 + if (substr($last_update_token, 0, 1) eq "c") {
91 + $last_update_token = "\"$last_update_token\"";
92 + $last_update_line = qq[\n"since": $last_update_token,];
93 + }
94 + my $query = <<" END";
95 + ["query", "$git_work_tree", {$last_update_line
96 + "fields": ["name"],
97 + "expression": ["not", ["dirname", ".git"]]
98 + }]
99 + END
100 +
101 + # Uncomment for debugging the watchman query
102 + # open (my $fh, ">", ".git/watchman-query.json");
103 + # print $fh $query;
104 + # close $fh;
105 +
106 + print CHLD_IN $query;
107 + close CHLD_IN;
108 + my $response = do {local $/; <CHLD_OUT>};
109 +
110 + # Uncomment for debugging the watch response
111 + # open ($fh, ">", ".git/watchman-response.json");
112 + # print $fh $response;
113 + # close $fh;
114 +
115 + die "Watchman: command returned no output.\n" .
116 + "Falling back to scanning...\n" if $response eq "";
117 + die "Watchman: command returned invalid output: $response\n" .
118 + "Falling back to scanning...\n" unless $response =~ /^\{/;
119 +
120 + return $json_pkg->new->utf8->decode($response);
121 +}
122 +
123 +sub is_work_tree_watched {
124 + my ($output) = @_;
125 + my $error = $output->{error};
126 + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
127 + $retry--;
128 + my $response = qx/watchman watch "$git_work_tree"/;
129 + die "Failed to make watchman watch '$git_work_tree'.\n" .
130 + "Falling back to scanning...\n" if $? != 0;
131 + $output = $json_pkg->new->utf8->decode($response);
132 + $error = $output->{error};
133 + die "Watchman: $error.\n" .
134 + "Falling back to scanning...\n" if $error;
135 +
136 + # Uncomment for debugging watchman output
137 + # open (my $fh, ">", ".git/watchman-output.out");
138 + # close $fh;
139 +
140 + # Watchman will always return all files on the first query so
141 + # return the fast "everything is dirty" flag to git and do the
142 + # Watchman query just to get it over with now so we won't pay
143 + # the cost in git to look up each individual file.
144 + my $o = watchman_clock();
145 + $error = $output->{error};
146 +
147 + die "Watchman: $error.\n" .
148 + "Falling back to scanning...\n" if $error;
149 +
150 + output_result($o->{clock}, ("/"));
151 + $last_update_token = $o->{clock};
152 +
153 + eval { launch_watchman() };
154 + return 0;
155 + }
156 +
157 + die "Watchman: $error.\n" .
158 + "Falling back to scanning...\n" if $error;
159 +
160 + return 1;
161 +}
162 +
163 +sub get_working_dir {
164 + my $working_dir;
165 + if ($^O =~ 'msys' || $^O =~ 'cygwin') {
166 + $working_dir = Win32::GetCwd();
167 + $working_dir =~ tr/\\/\//;
168 + } else {
169 + require Cwd;
170 + $working_dir = Cwd::cwd();
171 + }
172 +
173 + return $working_dir;
174 +}
1 +#!/bin/sh
2 +#
3 +# An example hook script to prepare a packed repository for use over
4 +# dumb transports.
5 +#
6 +# To enable this hook, rename this file to "post-update".
7 +
8 +exec git update-server-info
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed
4 +# by applypatch from an e-mail message.
5 +#
6 +# The hook should exit with non-zero status after issuing an
7 +# appropriate message if it wants to stop the commit.
8 +#
9 +# To enable this hook, rename this file to "pre-applypatch".
10 +
11 +. git-sh-setup
12 +precommit="$(git rev-parse --git-path hooks/pre-commit)"
13 +test -x "$precommit" && exec "$precommit" ${1+"$@"}
14 +:
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed.
4 +# Called by "git commit" with no arguments. The hook should
5 +# exit with non-zero status after issuing an appropriate message if
6 +# it wants to stop the commit.
7 +#
8 +# To enable this hook, rename this file to "pre-commit".
9 +
10 +if git rev-parse --verify HEAD >/dev/null 2>&1
11 +then
12 + against=HEAD
13 +else
14 + # Initial commit: diff against an empty tree object
15 + against=$(git hash-object -t tree /dev/null)
16 +fi
17 +
18 +# If you want to allow non-ASCII filenames set this variable to true.
19 +allownonascii=$(git config --type=bool hooks.allownonascii)
20 +
21 +# Redirect output to stderr.
22 +exec 1>&2
23 +
24 +# Cross platform projects tend to avoid non-ASCII filenames; prevent
25 +# them from being added to the repository. We exploit the fact that the
26 +# printable range starts at the space character and ends with tilde.
27 +if [ "$allownonascii" != "true" ] &&
28 + # Note that the use of brackets around a tr range is ok here, (it's
29 + # even required, for portability to Solaris 10's /usr/bin/tr), since
30 + # the square bracket bytes happen to fall in the designated range.
31 + test $(git diff --cached --name-only --diff-filter=A -z $against |
32 + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
33 +then
34 + cat <<\EOF
35 +Error: Attempt to add a non-ASCII file name.
36 +
37 +This can cause problems if you want to work with people on other platforms.
38 +
39 +To be portable it is advisable to rename the file.
40 +
41 +If you know what you are doing you can disable this check using:
42 +
43 + git config hooks.allownonascii true
44 +EOF
45 + exit 1
46 +fi
47 +
48 +# If there are whitespace errors, print the offending file names and fail.
49 +exec git diff-index --check --cached $against --
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed.
4 +# Called by "git merge" with no arguments. The hook should
5 +# exit with non-zero status after issuing an appropriate message to
6 +# stderr if it wants to stop the merge commit.
7 +#
8 +# To enable this hook, rename this file to "pre-merge-commit".
9 +
10 +. git-sh-setup
11 +test -x "$GIT_DIR/hooks/pre-commit" &&
12 + exec "$GIT_DIR/hooks/pre-commit"
13 +:
1 +#!/bin/sh
2 +
3 +# An example hook script to verify what is about to be pushed. Called by "git
4 +# push" after it has checked the remote status, but before anything has been
5 +# pushed. If this script exits with a non-zero status nothing will be pushed.
6 +#
7 +# This hook is called with the following parameters:
8 +#
9 +# $1 -- Name of the remote to which the push is being done
10 +# $2 -- URL to which the push is being done
11 +#
12 +# If pushing without using a named remote those arguments will be equal.
13 +#
14 +# Information about the commits which are being pushed is supplied as lines to
15 +# the standard input in the form:
16 +#
17 +# <local ref> <local oid> <remote ref> <remote oid>
18 +#
19 +# This sample shows how to prevent push of commits where the log message starts
20 +# with "WIP" (work in progress).
21 +
22 +remote="$1"
23 +url="$2"
24 +
25 +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
26 +
27 +while read local_ref local_oid remote_ref remote_oid
28 +do
29 + if test "$local_oid" = "$zero"
30 + then
31 + # Handle delete
32 + :
33 + else
34 + if test "$remote_oid" = "$zero"
35 + then
36 + # New branch, examine all commits
37 + range="$local_oid"
38 + else
39 + # Update to existing branch, examine new commits
40 + range="$remote_oid..$local_oid"
41 + fi
42 +
43 + # Check for WIP commit
44 + commit=$(git rev-list -n 1 --grep '^WIP' "$range")
45 + if test -n "$commit"
46 + then
47 + echo >&2 "Found WIP commit in $local_ref, not pushing"
48 + exit 1
49 + fi
50 + fi
51 +done
52 +
53 +exit 0
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2006, 2008 Junio C Hamano
4 +#
5 +# The "pre-rebase" hook is run just before "git rebase" starts doing
6 +# its job, and can prevent the command from running by exiting with
7 +# non-zero status.
8 +#
9 +# The hook is called with the following parameters:
10 +#
11 +# $1 -- the upstream the series was forked from.
12 +# $2 -- the branch being rebased (or empty when rebasing the current branch).
13 +#
14 +# This sample shows how to prevent topic branches that are already
15 +# merged to 'next' branch from getting rebased, because allowing it
16 +# would result in rebasing already published history.
17 +
18 +publish=next
19 +basebranch="$1"
20 +if test "$#" = 2
21 +then
22 + topic="refs/heads/$2"
23 +else
24 + topic=`git symbolic-ref HEAD` ||
25 + exit 0 ;# we do not interrupt rebasing detached HEAD
26 +fi
27 +
28 +case "$topic" in
29 +refs/heads/??/*)
30 + ;;
31 +*)
32 + exit 0 ;# we do not interrupt others.
33 + ;;
34 +esac
35 +
36 +# Now we are dealing with a topic branch being rebased
37 +# on top of master. Is it OK to rebase it?
38 +
39 +# Does the topic really exist?
40 +git show-ref -q "$topic" || {
41 + echo >&2 "No such branch $topic"
42 + exit 1
43 +}
44 +
45 +# Is topic fully merged to master?
46 +not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
47 +if test -z "$not_in_master"
48 +then
49 + echo >&2 "$topic is fully merged to master; better remove it."
50 + exit 1 ;# we could allow it, but there is no point.
51 +fi
52 +
53 +# Is topic ever merged to next? If so you should not be rebasing it.
54 +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
55 +only_next_2=`git rev-list ^master ${publish} | sort`
56 +if test "$only_next_1" = "$only_next_2"
57 +then
58 + not_in_topic=`git rev-list "^$topic" master`
59 + if test -z "$not_in_topic"
60 + then
61 + echo >&2 "$topic is already up to date with master"
62 + exit 1 ;# we could allow it, but there is no point.
63 + else
64 + exit 0
65 + fi
66 +else
67 + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
68 + /usr/bin/perl -e '
69 + my $topic = $ARGV[0];
70 + my $msg = "* $topic has commits already merged to public branch:\n";
71 + my (%not_in_next) = map {
72 + /^([0-9a-f]+) /;
73 + ($1 => 1);
74 + } split(/\n/, $ARGV[1]);
75 + for my $elem (map {
76 + /^([0-9a-f]+) (.*)$/;
77 + [$1 => $2];
78 + } split(/\n/, $ARGV[2])) {
79 + if (!exists $not_in_next{$elem->[0]}) {
80 + if ($msg) {
81 + print STDERR $msg;
82 + undef $msg;
83 + }
84 + print STDERR " $elem->[1]\n";
85 + }
86 + }
87 + ' "$topic" "$not_in_next" "$not_in_master"
88 + exit 1
89 +fi
90 +
91 +<<\DOC_END
92 +
93 +This sample hook safeguards topic branches that have been
94 +published from being rewound.
95 +
96 +The workflow assumed here is:
97 +
98 + * Once a topic branch forks from "master", "master" is never
99 + merged into it again (either directly or indirectly).
100 +
101 + * Once a topic branch is fully cooked and merged into "master",
102 + it is deleted. If you need to build on top of it to correct
103 + earlier mistakes, a new topic branch is created by forking at
104 + the tip of the "master". This is not strictly necessary, but
105 + it makes it easier to keep your history simple.
106 +
107 + * Whenever you need to test or publish your changes to topic
108 + branches, merge them into "next" branch.
109 +
110 +The script, being an example, hardcodes the publish branch name
111 +to be "next", but it is trivial to make it configurable via
112 +$GIT_DIR/config mechanism.
113 +
114 +With this workflow, you would want to know:
115 +
116 +(1) ... if a topic branch has ever been merged to "next". Young
117 + topic branches can have stupid mistakes you would rather
118 + clean up before publishing, and things that have not been
119 + merged into other branches can be easily rebased without
120 + affecting other people. But once it is published, you would
121 + not want to rewind it.
122 +
123 +(2) ... if a topic branch has been fully merged to "master".
124 + Then you can delete it. More importantly, you should not
125 + build on top of it -- other people may already want to
126 + change things related to the topic as patches against your
127 + "master", so if you need further changes, it is better to
128 + fork the topic (perhaps with the same name) afresh from the
129 + tip of "master".
130 +
131 +Let's look at this example:
132 +
133 + o---o---o---o---o---o---o---o---o---o "next"
134 + / / / /
135 + / a---a---b A / /
136 + / / / /
137 + / / c---c---c---c B /
138 + / / / \ /
139 + / / / b---b C \ /
140 + / / / / \ /
141 + ---o---o---o---o---o---o---o---o---o---o---o "master"
142 +
143 +
144 +A, B and C are topic branches.
145 +
146 + * A has one fix since it was merged up to "next".
147 +
148 + * B has finished. It has been fully merged up to "master" and "next",
149 + and is ready to be deleted.
150 +
151 + * C has not merged to "next" at all.
152 +
153 +We would want to allow C to be rebased, refuse A, and encourage
154 +B to be deleted.
155 +
156 +To compute (1):
157 +
158 + git rev-list ^master ^topic next
159 + git rev-list ^master next
160 +
161 + if these match, topic has not merged in next at all.
162 +
163 +To compute (2):
164 +
165 + git rev-list master..topic
166 +
167 + if this is empty, it is fully merged to "master".
168 +
169 +DOC_END
1 +#!/bin/sh
2 +#
3 +# An example hook script to make use of push options.
4 +# The example simply echoes all push options that start with 'echoback='
5 +# and rejects all pushes when the "reject" push option is used.
6 +#
7 +# To enable this hook, rename this file to "pre-receive".
8 +
9 +if test -n "$GIT_PUSH_OPTION_COUNT"
10 +then
11 + i=0
12 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
13 + do
14 + eval "value=\$GIT_PUSH_OPTION_$i"
15 + case "$value" in
16 + echoback=*)
17 + echo "echo from the pre-receive-hook: ${value#*=}" >&2
18 + ;;
19 + reject)
20 + exit 1
21 + esac
22 + i=$((i + 1))
23 + done
24 +fi
1 +#!/bin/sh
2 +#
3 +# An example hook script to prepare the commit log message.
4 +# Called by "git commit" with the name of the file that has the
5 +# commit message, followed by the description of the commit
6 +# message's source. The hook's purpose is to edit the commit
7 +# message file. If the hook fails with a non-zero status,
8 +# the commit is aborted.
9 +#
10 +# To enable this hook, rename this file to "prepare-commit-msg".
11 +
12 +# This hook includes three examples. The first one removes the
13 +# "# Please enter the commit message..." help message.
14 +#
15 +# The second includes the output of "git diff --name-status -r"
16 +# into the message, just before the "git status" output. It is
17 +# commented because it doesn't cope with --amend or with squashed
18 +# commits.
19 +#
20 +# The third example adds a Signed-off-by line to the message, that can
21 +# still be edited. This is rarely a good idea.
22 +
23 +COMMIT_MSG_FILE=$1
24 +COMMIT_SOURCE=$2
25 +SHA1=$3
26 +
27 +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
28 +
29 +# case "$COMMIT_SOURCE,$SHA1" in
30 +# ,|template,)
31 +# /usr/bin/perl -i.bak -pe '
32 +# print "\n" . `git diff --cached --name-status -r`
33 +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
34 +# *) ;;
35 +# esac
36 +
37 +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
38 +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
39 +# if test -z "$COMMIT_SOURCE"
40 +# then
41 +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
42 +# fi
1 +#!/bin/sh
2 +
3 +# An example hook script to update a checked-out tree on a git push.
4 +#
5 +# This hook is invoked by git-receive-pack(1) when it reacts to git
6 +# push and updates reference(s) in its repository, and when the push
7 +# tries to update the branch that is currently checked out and the
8 +# receive.denyCurrentBranch configuration variable is set to
9 +# updateInstead.
10 +#
11 +# By default, such a push is refused if the working tree and the index
12 +# of the remote repository has any difference from the currently
13 +# checked out commit; when both the working tree and the index match
14 +# the current commit, they are updated to match the newly pushed tip
15 +# of the branch. This hook is to be used to override the default
16 +# behaviour; however the code below reimplements the default behaviour
17 +# as a starting point for convenient modification.
18 +#
19 +# The hook receives the commit with which the tip of the current
20 +# branch is going to be updated:
21 +commit=$1
22 +
23 +# It can exit with a non-zero status to refuse the push (when it does
24 +# so, it must not modify the index or the working tree).
25 +die () {
26 + echo >&2 "$*"
27 + exit 1
28 +}
29 +
30 +# Or it can make any necessary changes to the working tree and to the
31 +# index to bring them to the desired state when the tip of the current
32 +# branch is updated to the new commit, and exit with a zero status.
33 +#
34 +# For example, the hook can simply run git read-tree -u -m HEAD "$1"
35 +# in order to emulate git fetch that is run in the reverse direction
36 +# with git push, as the two-tree form of git read-tree -u -m is
37 +# essentially the same as git switch or git checkout that switches
38 +# branches while keeping the local changes in the working tree that do
39 +# not interfere with the difference between the branches.
40 +
41 +# The below is a more-or-less exact translation to shell of the C code
42 +# for the default behaviour for git's push-to-checkout hook defined in
43 +# the push_to_deploy() function in builtin/receive-pack.c.
44 +#
45 +# Note that the hook will be executed from the repository directory,
46 +# not from the working tree, so if you want to perform operations on
47 +# the working tree, you will have to adapt your code accordingly, e.g.
48 +# by adding "cd .." or using relative paths.
49 +
50 +if ! git update-index -q --ignore-submodules --refresh
51 +then
52 + die "Up-to-date check failed"
53 +fi
54 +
55 +if ! git diff-files --quiet --ignore-submodules --
56 +then
57 + die "Working directory has unstaged changes"
58 +fi
59 +
60 +# This is a rough translation of:
61 +#
62 +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
63 +if git cat-file -e HEAD 2>/dev/null
64 +then
65 + head=HEAD
66 +else
67 + head=$(git hash-object -t tree --stdin </dev/null)
68 +fi
69 +
70 +if ! git diff-index --quiet --cached --ignore-submodules $head --
71 +then
72 + die "Working directory has staged changes"
73 +fi
74 +
75 +if ! git read-tree -u -m "$commit"
76 +then
77 + die "Could not update working tree to new HEAD"
78 +fi
1 +#!/bin/sh
2 +#
3 +# An example hook script to block unannotated tags from entering.
4 +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
5 +#
6 +# To enable this hook, rename this file to "update".
7 +#
8 +# Config
9 +# ------
10 +# hooks.allowunannotated
11 +# This boolean sets whether unannotated tags will be allowed into the
12 +# repository. By default they won't be.
13 +# hooks.allowdeletetag
14 +# This boolean sets whether deleting tags will be allowed in the
15 +# repository. By default they won't be.
16 +# hooks.allowmodifytag
17 +# This boolean sets whether a tag may be modified after creation. By default
18 +# it won't be.
19 +# hooks.allowdeletebranch
20 +# This boolean sets whether deleting branches will be allowed in the
21 +# repository. By default they won't be.
22 +# hooks.denycreatebranch
23 +# This boolean sets whether remotely creating branches will be denied
24 +# in the repository. By default this is allowed.
25 +#
26 +
27 +# --- Command line
28 +refname="$1"
29 +oldrev="$2"
30 +newrev="$3"
31 +
32 +# --- Safety check
33 +if [ -z "$GIT_DIR" ]; then
34 + echo "Don't run this script from the command line." >&2
35 + echo " (if you want, you could supply GIT_DIR then run" >&2
36 + echo " $0 <ref> <oldrev> <newrev>)" >&2
37 + exit 1
38 +fi
39 +
40 +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
41 + echo "usage: $0 <ref> <oldrev> <newrev>" >&2
42 + exit 1
43 +fi
44 +
45 +# --- Config
46 +allowunannotated=$(git config --type=bool hooks.allowunannotated)
47 +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
48 +denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
49 +allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
50 +allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
51 +
52 +# check for no description
53 +projectdesc=$(sed -e '1q' "$GIT_DIR/description")
54 +case "$projectdesc" in
55 +"Unnamed repository"* | "")
56 + echo "*** Project description file hasn't been set" >&2
57 + exit 1
58 + ;;
59 +esac
60 +
61 +# --- Check types
62 +# if $newrev is 0000...0000, it's a commit to delete a ref.
63 +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
64 +if [ "$newrev" = "$zero" ]; then
65 + newrev_type=delete
66 +else
67 + newrev_type=$(git cat-file -t $newrev)
68 +fi
69 +
70 +case "$refname","$newrev_type" in
71 + refs/tags/*,commit)
72 + # un-annotated tag
73 + short_refname=${refname##refs/tags/}
74 + if [ "$allowunannotated" != "true" ]; then
75 + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
76 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
77 + exit 1
78 + fi
79 + ;;
80 + refs/tags/*,delete)
81 + # delete tag
82 + if [ "$allowdeletetag" != "true" ]; then
83 + echo "*** Deleting a tag is not allowed in this repository" >&2
84 + exit 1
85 + fi
86 + ;;
87 + refs/tags/*,tag)
88 + # annotated tag
89 + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
90 + then
91 + echo "*** Tag '$refname' already exists." >&2
92 + echo "*** Modifying a tag is not allowed in this repository." >&2
93 + exit 1
94 + fi
95 + ;;
96 + refs/heads/*,commit)
97 + # branch
98 + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
99 + echo "*** Creating a branch is not allowed in this repository" >&2
100 + exit 1
101 + fi
102 + ;;
103 + refs/heads/*,delete)
104 + # delete branch
105 + if [ "$allowdeletebranch" != "true" ]; then
106 + echo "*** Deleting a branch is not allowed in this repository" >&2
107 + exit 1
108 + fi
109 + ;;
110 + refs/remotes/*,commit)
111 + # tracking branch
112 + ;;
113 + refs/remotes/*,delete)
114 + # delete tracking branch
115 + if [ "$allowdeletebranch" != "true" ]; then
116 + echo "*** Deleting a tracking branch is not allowed in this repository" >&2
117 + exit 1
118 + fi
119 + ;;
120 + *)
121 + # Anything else (is there anything else?)
122 + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
123 + exit 1
124 + ;;
125 +esac
126 +
127 +# --- Finished
128 +exit 0
1 +# git ls-files --others --exclude-from=.git/info/exclude
2 +# Lines that start with '#' are comments.
3 +# For a project mostly in C, the following would be a good set of
4 +# exclude patterns (uncomment them if you want to use them):
5 +# *.[oa]
6 +# *~
1 +# pack-refs with: peeled fully-peeled sorted
2 +21b726e130241a804c72afad4d1c0b0d7d9fd706 refs/heads/Swift-2.3
3 +aa0be8b53946ba2a1044cd9c5f590f82708e9578 refs/heads/Swift-3.0
4 +fde53070cdf5c5fde92697d33512161486cc37b9 refs/heads/master
5 +19ec93187ac7e4d89d73e1dc9d4803143cb9e4b0 refs/pull/101/head
6 +e969d0470f9059edd55f84d3ea4b016c6953f284 refs/pull/102/head
7 +44948e94bed7dad0be19f8b594e4c9112e539124 refs/pull/102/merge
8 +3a0e9b07ad5e6e8c429f8e444904d98de26807b8 refs/pull/103/head
9 +fee5860c7ba84cc72b086d55544f042dbe6e9c99 refs/pull/104/head
10 +e366f99be724eff982886ab640529bd93f78375b refs/pull/107/head
11 +20692d8c8e881b73f72a85263c615f03da08933c refs/pull/109/head
12 +e41b8679d9c1473bf70391ae29312aa13924b2b8 refs/pull/111/head
13 +c36c8e90faf1f0fc9c9f03bd9878229174210e4e refs/pull/112/head
14 +14be9ff495114d595ff609e7c411390118a9099b refs/pull/113/head
15 +3fb32a1fabe693565a0f5690db332492250a4929 refs/pull/115/head
16 +d270bc04ff2d84e8f6374cd5c59239cbd0632013 refs/pull/115/merge
17 +bd835a9efc690ce27752b3c0c2d5fe22e29a814e refs/pull/12/head
18 +4eccb8a653869d5fd6002814a790bc764c602c10 refs/pull/120/head
19 +94b51ed6db9c445efc4009b47e95930f85cf5d26 refs/pull/120/merge
20 +c1d7d08e1452a98725f29c515bbb6208a64fad67 refs/pull/121/head
21 +d8c1d83657142a679400ab66873a2d1587ec7b60 refs/pull/124/head
22 +0443c04916d18c004c1bd72ab3d414645dc4035e refs/pull/126/head
23 +e5ba3d08acd80225d5afa91a250e662fa2f4fff9 refs/pull/127/head
24 +55fb0d7c37c0f035a9e3661fac96ea34e54803d5 refs/pull/128/head
25 +ae5e952ff535d3ec5aa1fbe288c39fd6f4be2471 refs/pull/134/head
26 +c61bd75f3338960207dedcd657ff726889bee8ce refs/pull/135/head
27 +0ab6f3bd20374d961e6d154883617f3dee0e84f0 refs/pull/137/head
28 +ad87172f602fdc0f0184490caf8361c4179b8602 refs/pull/140/head
29 +cb7cd1feb13543b9577dac5717f901c803ffb9db refs/pull/145/head
30 +aa7854967b3b2f850bfe002f1fbeb2cc73235e38 refs/pull/146/head
31 +60ec718f6b33b3762176a8d8aedd39753f650fcf refs/pull/152/head
32 +ede410f6e493d9b81ec1540e45a9fb0ba80e62a4 refs/pull/155/head
33 +23fbf131c4bc947e03cf0cd6cafb0c79f26be9df refs/pull/155/merge
34 +e87854d5ac1e9b302b83597ae41186e578992b5d refs/pull/159/head
35 +33550ecc1c94eb6b6872dd7580530b97642fa5be refs/pull/159/merge
36 +ffb46920cd5e90891f6f37d26125ded73e542222 refs/pull/17/head
37 +9fd32eda55247d9e36dfce1def41729e0bbc96ee refs/pull/19/head
38 +1375065d97e7d520d6c429efdf1b8945ac05685c refs/pull/20/head
39 +131e644ade8a818d2d4fed8c4394f2c27270fd36 refs/pull/27/head
40 +5b844e8b9cf1b0b52d711f32bc11ba43a0beef95 refs/pull/29/head
41 +e16066f446980b0ac0ac3f3efb265742f3950697 refs/pull/3/head
42 +a846ac33c3ae489a92c772fe11723fd83ba541e0 refs/pull/3/merge
43 +0ae0cd3b2591d916ba0eda0dfb5fd99b17eefe44 refs/pull/31/head
44 +0c96232acb14821ca95cb3f450f93e36089a3194 refs/pull/31/merge
45 +d3c89b0231976afa5be74a424952dae4934b1246 refs/pull/32/head
46 +5bd553d72c442d3f605d4aeb06263c15a6844499 refs/pull/36/head
47 +835ecdbc9e65dfb0f4406451115223a1e9f8fd50 refs/pull/42/head
48 +7922332d8cd445dd5c57003f4fee3fa1aeb74150 refs/pull/47/head
49 +80cad6ca9c5e01f6bf7ef49ae53133bc6ee30c2c refs/pull/50/head
50 +7d51cf5db44098cc9aa0e9056eb206bd31db514c refs/pull/52/head
51 +2c2532f50265b71bbd50527480f76b558d561836 refs/pull/55/head
52 +4fd56a9edf5f5333aa81893223c4223dd7bf687d refs/pull/59/head
53 +bb06163748021404f51205ed7e65c4ecfd1189d8 refs/pull/62/head
54 +366e2662e6629192f9cdeec02ec4ae7c637bd4ac refs/pull/62/merge
55 +2f356bcbce90aa4a97a0cbfc907b4be005c7946b refs/pull/63/head
56 +2fa968f3b4cb46c67e24bf75c9bbefd1e1553789 refs/pull/63/merge
57 +9404a387664cd782f1fcc3a1a81362fedecaf259 refs/pull/64/head
58 +5905554be374626950397274e9298be14093ff7a refs/pull/64/merge
59 +42dfe496539efc18fc611a08e3c27f51a558c520 refs/pull/66/head
60 +7a8079fe97e659cee5808adde4fd3f471f59876e refs/pull/69/head
61 +aa0be8b53946ba2a1044cd9c5f590f82708e9578 refs/pull/70/head
62 +568e6bb3efe04d7db945cda4b104154143301636 refs/pull/78/head
63 +9ad85cc8115f9cdb174e734317598a72a96a0382 refs/pull/82/head
64 +ac71ca0da8ce224b28faaf57ba03f9a6226cd645 refs/pull/83/head
65 +a785491667ec4b7daf2a065cc9dcde3249e94365 refs/pull/84/head
66 +49c0a1c4ba52ca6b756a11c3451e25e8f5f0b5d0 refs/pull/86/head
67 +da8c047b9938d43e526df43e9ed3c5b230504847 refs/pull/89/head
68 +8024247e262fa39286323559f2396fd6facd8cd1 refs/pull/94/head
69 +239eb3952c8c31b7c904dd367762ff14e90dbbc7 refs/pull/99/head
70 +a72f9ca9f3a68d95a7d41b0b84300341762a85a6 refs/tags/0.0.1
71 +^00ce239f8d3eb557ddcbd8aa1452c337b257b8a0
72 +d1987dccb2685c96e25dd6c89fda05fd5f640903 refs/tags/0.0.2
73 +^c217a63a341d4b7342e7397f72659b59a9bb763a
74 +90b9af64ca786a111a6065b94d657ef286ec1b66 refs/tags/0.0.3
75 +^606868c385eebd1b67c285eb9d50c78edbfc5332
76 +5a910a73fdec86b8ad6c3f0cb8500918954088b8 refs/tags/0.0.4
77 +^bfeb7e182a7ab4b25c003c5433962a9e35483a33
78 +c0081046c91bceeb4607b367a1cf78a9f8b009af refs/tags/0.0.5
79 +^1b9ac46f5c3d36e03baf98b258449c246ea1b6d6
80 +784586dcb61ca434e9a9d4994dd317fafcf346a8 refs/tags/0.0.6
81 +^55058b5967af206ecb7e83f2e093dd5cfe7307cf
82 +75ce11b3ea3532b01cd1dd3df7189652a8a3e9a3 refs/tags/0.0.7
83 +^e000eefda3bab533a4cd03a36de0d874dfde9c1b
84 +fc863688860338fdd0a72c8702b9f7d2ca7f31a2 refs/tags/0.0.8
85 +^5c8609a0b7a6a431313372ea7e3f3466cd8fd2f4
86 +9faf0b83b87b39041f0ba02f7c0fce74a374d6d5 refs/tags/0.1.0
87 +^dca6269033015a30295f02e00ea193c545cd95dc
88 +84c6bb53ed04ffee25a2afffbe5f022048d78322 refs/tags/0.1.4
89 +^60cc1a9852b17a2d5e587a766f9734d8f3f916d1
90 +f74aa68a6ddceb133b8f5753b3faf8dc52735349 refs/tags/0.1.5
91 +^19453fa68fcda2273f61294a7cb8e04b13c8d36b
92 +cb0aa1f4de05758b7d89e4cecc80b32bcc78c7a3 refs/tags/0.1.6
93 +^c4eb9c5d2510cf231f02b1491831b0d102896c7c
94 +6240c2054e83ebd3d90041aab2f514833f0b8d58 refs/tags/0.1.7
95 +^b212dc649fbab8be89178f2b0491fe0ded806934
96 +696f3669a4ff3b6f7c7ace37aea38d4397327e80 refs/tags/0.1.8
97 +^426594eeb7718f5c0afcb6865e37f2a19395ba5e
98 +3baa430a546faa3e59e69b557e36b9a03c623663 refs/tags/0.1.9
99 +^0f5c7b2f4e8cf9febc62844dcc6241e2d0fb2cd4
100 +71486b3af3308c542e0eabe23039e87ff78cacf0 refs/tags/2.3
101 +^efd644b20ebaa36701bc96d69f1f837132344d33
102 +54e801d6b8a7a32279ab5ffc727f159acbcbc575 refs/tags/2.3.1
103 +^8f13828c8f79f25c2f04bf689c4427524ab82db9
104 +66daeba9b5389be84d463c5a2be866bdcc843578 refs/tags/2.3.2
105 +^7c88a7f4acea210e66f6f325ddd7a18385277cb4
106 +54b859e2dfd2e6f6e748df391ecc46b5d0289716 refs/tags/2.3.3
107 +^21b726e130241a804c72afad4d1c0b0d7d9fd706
108 +92609b2e4c8c92c970b7bdf27f09d7e743c44f86 refs/tags/3.0
109 +^5b15abd39ef4c4fffd3da30fcd4dd65d8d3aa5f4
110 +973799ceb3b1787ba5de99717b34a3a91cb391bd refs/tags/3.0.1
111 +^4e4f7b0720aa8a6db1722e389ec45b5bce05063d
112 +14fbaf445edd4f9a7ec8ae147bb8d017cc04455b refs/tags/3.0.2
113 +^3609941f1e085766bcf7fc59e4e60e0d494ca136
114 +3954fb40d2d1efdb520c09fb7cb79b42e3c24a69 refs/tags/3.0.3
115 +^5dfc25c26426cee02b318c7604f381153c1e78e2
116 +8bbb75fab51bffc5f128c3d069b21e13b5f4fcad refs/tags/4.0.0
117 +^02e5341bcb270cf1ba932d583e7911f6df79dbef
118 +598f5ea762399853a0bf92927be54c60f0daaebb refs/tags/4.2.0
119 +^ccaacedbddf20a0562867a175045e82e43e48afc
120 +17b4ec9ec23ff4407eef1c4d2ad7d0de695e28f2 refs/tags/4.2.1
121 +^27933d501fc26fa9a9d58b262c3c69c657459ff1
122 +5487616ca255f035624f27386d9953373a155973 refs/tags/5.0.0
123 +^39c3d8c6ee6eac332620b6cab61e166771ddbe04
124 +1f68053c1a625ac77ba3f0b02b89172613473452 refs/tags/5.0.1
125 +^52e28dd4f2a635c2ad74abc3809eda01c0a8e3da
126 +1bf97d258be9c2b18b9f8d2d93d64c2b30fea52c refs/tags/5.0.2
127 +^45b57257495965e7c6ffe28b9bdaabb7fa7b83a2
128 +33c9e76678878df3d31c8bc55c648bd1cc4c99a1 refs/tags/5.1.0
129 +^552d7151e630ec2ef1f5e3d358946ccc60092cdd
130 +a36f3cb1cf17e034587c4c6e1a16b52598b2179a refs/tags/5.1.1
131 +^86d8b1a1439e7edb19793d17732b15fd784a0a15
132 +90af4e5a700dc044a612b77ef4190398b907e889 refs/tags/5.2.0
133 +^241de72a96f49b1545d5de3c00fae170c2675c41
1 +0ce6a159e4e0aa1eba1eb8c09499302a9c62d74f not-for-merge branch 'feature/allow-structs-as-sender' of https://github.com/cesarferreira/SwiftEventBus
2 +a30ff35e616f507d8a8d122dac32a2150371a87e not-for-merge branch 'master' of https://github.com/cesarferreira/SwiftEventBus
3 +276e13088358d534ec2b6af5a9cdc6b29f13b82f not-for-merge branch 'revert-47-master' of https://github.com/cesarferreira/SwiftEventBus
4 +e4e8d93de0da1145bc5cd321a335e903f2ab0c9e not-for-merge 'refs/pull/13/head' of https://github.com/cesarferreira/SwiftEventBus
5 +40da1a6aa4edb45f4a13f7f5a9602eaf1e984ba4 not-for-merge 'refs/pull/16/head' of https://github.com/cesarferreira/SwiftEventBus
6 +28300d1cdc1e92f372bcd60e704a234f30f2085f not-for-merge 'refs/pull/18/head' of https://github.com/cesarferreira/SwiftEventBus
7 +e051a643d52118387bb5d0f84430e3c54a9fdd45 not-for-merge 'refs/pull/20/head' of https://github.com/cesarferreira/SwiftEventBus
8 +53aecbef63b3635be01a3c6b4caa666e33533ce7 not-for-merge 'refs/pull/21/head' of https://github.com/cesarferreira/SwiftEventBus
9 +05ac44912160207058d2193421e4d0be40368158 not-for-merge 'refs/pull/23/head' of https://github.com/cesarferreira/SwiftEventBus
10 +fb0e021acf449af4dbec3478e23abe8097904efd not-for-merge 'refs/pull/24/head' of https://github.com/cesarferreira/SwiftEventBus
11 +61da869aa74e03a89e854f2e55d2d16fcbcc844d not-for-merge 'refs/pull/3/head' of https://github.com/cesarferreira/SwiftEventBus
12 +6a09b33a22303065b0b2350182b2a5834cacf778 not-for-merge 'refs/pull/34/head' of https://github.com/cesarferreira/SwiftEventBus
13 +d09b4320b64e82853e83975817384ac96da1a066 not-for-merge 'refs/pull/36/head' of https://github.com/cesarferreira/SwiftEventBus
14 +ab2af426b3a340d329090b242869d0ea4c660eba not-for-merge 'refs/pull/45/head' of https://github.com/cesarferreira/SwiftEventBus
15 +a2b1d3dfdb3c7a8a828d60e1b869a721e8b1ab1b not-for-merge 'refs/pull/46/head' of https://github.com/cesarferreira/SwiftEventBus
16 +b0cce4977fc0e23da1004446d7ec6f7f9706f1d5 not-for-merge 'refs/pull/47/head' of https://github.com/cesarferreira/SwiftEventBus
17 +1ab88a1f6eaf1877b1bf8ed670e2681dc1455caf not-for-merge 'refs/pull/51/head' of https://github.com/cesarferreira/SwiftEventBus
18 +8fdb6e8f41891acdceaec768bc06d6faa9fa128b not-for-merge 'refs/pull/54/head' of https://github.com/cesarferreira/SwiftEventBus
19 +e31bd014cc991232cd5ea677499309f3ad9122f9 not-for-merge 'refs/pull/6/head' of https://github.com/cesarferreira/SwiftEventBus
20 +f0c10a622f1a5ea8818aa02935f874da2dcb8c7e not-for-merge 'refs/pull/62/head' of https://github.com/cesarferreira/SwiftEventBus
21 +ab2a23532cd6a59994e80ae3c987d0001165d29c not-for-merge 'refs/pull/7/head' of https://github.com/cesarferreira/SwiftEventBus
22 +a3c42b4f0c50672167fbe47be4151a29c7cc204d not-for-merge 'refs/pull/7/merge' of https://github.com/cesarferreira/SwiftEventBus
23 +aa5f21eff0588e015f89aa9178f76dd5d79be5d7 not-for-merge 'refs/pull/8/head' of https://github.com/cesarferreira/SwiftEventBus
24 +e3fba8129c4dfbe46e0ed2316b57f3eaa39aabb8 not-for-merge 'refs/pull/9/head' of https://github.com/cesarferreira/SwiftEventBus
25 +149349d0d6d527ecbec4b54f0ede576fc53e6797 not-for-merge 'refs/pull/9/merge' of https://github.com/cesarferreira/SwiftEventBus
26 +2510df2e742030c0df3083dd85b5ef35dd5af67d not-for-merge tag '1.0.0' of https://github.com/cesarferreira/SwiftEventBus
27 +a161c251f10fcd18742b1b544e200d0c949adcb3 not-for-merge tag '1.1.0' of https://github.com/cesarferreira/SwiftEventBus
28 +be2cbe06b7fda3d86971893ceee64984dc538626 not-for-merge tag '2.0.0' of https://github.com/cesarferreira/SwiftEventBus
29 +f92b6243116f2332b6bbb3a8b81f7bfdaa311251 not-for-merge tag '2.0.1' of https://github.com/cesarferreira/SwiftEventBus
30 +4c6e14084affc79f327fa588505ecfc2a03b3870 not-for-merge tag '2.0.2' of https://github.com/cesarferreira/SwiftEventBus
31 +a727cea7caefea3f29de42f9fa995c10b95ad246 not-for-merge tag '2.1.0' of https://github.com/cesarferreira/SwiftEventBus
32 +9cfef1d3a33412a42b648ef384d214b555b76d59 not-for-merge tag '2.1.1' of https://github.com/cesarferreira/SwiftEventBus
33 +917ae5666ff0f6a1247a5d58f3029e60dff9c4d0 not-for-merge tag '2.1.2' of https://github.com/cesarferreira/SwiftEventBus
34 +efab81530999fe9939fc78df7fbddd228f7bb588 not-for-merge tag '2.2.0' of https://github.com/cesarferreira/SwiftEventBus
35 +5473005cc6027e644291a4931ae7addb7b37a2c3 not-for-merge tag '3.0.0' of https://github.com/cesarferreira/SwiftEventBus
36 +60ec5d415f05b9036ce77af9dccffdc17eab18bf not-for-merge tag '3.0.1' of https://github.com/cesarferreira/SwiftEventBus
37 +f66223012e8143fa4a37cd61c59a2cb8cb409afe not-for-merge tag '5.0.0' of https://github.com/cesarferreira/SwiftEventBus
38 +d1516f096198824a3d06c2d201bc1cf9fc15a42d not-for-merge tag '5.0.1' of https://github.com/cesarferreira/SwiftEventBus
39 +eb98b9baecfdc0102e4bde2a2e592f2168fad291 not-for-merge tag '5.1.0' of https://github.com/cesarferreira/SwiftEventBus
1 +[core]
2 + repositoryformatversion = 0
3 + filemode = true
4 + bare = true
5 + ignorecase = true
6 + precomposeunicode = true
7 +[remote "origin"]
8 + url = https://github.com/cesarferreira/SwiftEventBus
9 + fetch = +refs/*:refs/*
10 + mirror = true
1 +Unnamed repository; edit this file 'description' to name the repository.
1 +#!/bin/sh
2 +#
3 +# An example hook script to check the commit log message taken by
4 +# applypatch from an e-mail message.
5 +#
6 +# The hook should exit with non-zero status after issuing an
7 +# appropriate message if it wants to stop the commit. The hook is
8 +# allowed to edit the commit message file.
9 +#
10 +# To enable this hook, rename this file to "applypatch-msg".
11 +
12 +. git-sh-setup
13 +commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
14 +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
15 +:
1 +#!/bin/sh
2 +#
3 +# An example hook script to check the commit log message.
4 +# Called by "git commit" with one argument, the name of the file
5 +# that has the commit message. The hook should exit with non-zero
6 +# status after issuing an appropriate message if it wants to stop the
7 +# commit. The hook is allowed to edit the commit message file.
8 +#
9 +# To enable this hook, rename this file to "commit-msg".
10 +
11 +# Uncomment the below to add a Signed-off-by line to the message.
12 +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13 +# hook is more suited to it.
14 +#
15 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17 +
18 +# This example catches duplicate Signed-off-by lines.
19 +
20 +test "" = "$(grep '^Signed-off-by: ' "$1" |
21 + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22 + echo >&2 Duplicate Signed-off-by lines.
23 + exit 1
24 +}
1 +#!/usr/bin/perl
2 +
3 +use strict;
4 +use warnings;
5 +use IPC::Open2;
6 +
7 +# An example hook script to integrate Watchman
8 +# (https://facebook.github.io/watchman/) with git to speed up detecting
9 +# new and modified files.
10 +#
11 +# The hook is passed a version (currently 2) and last update token
12 +# formatted as a string and outputs to stdout a new update token and
13 +# all files that have been modified since the update token. Paths must
14 +# be relative to the root of the working tree and separated by a single NUL.
15 +#
16 +# To enable this hook, rename this file to "query-watchman" and set
17 +# 'git config core.fsmonitor .git/hooks/query-watchman'
18 +#
19 +my ($version, $last_update_token) = @ARGV;
20 +
21 +# Uncomment for debugging
22 +# print STDERR "$0 $version $last_update_token\n";
23 +
24 +# Check the hook interface version
25 +if ($version ne 2) {
26 + die "Unsupported query-fsmonitor hook version '$version'.\n" .
27 + "Falling back to scanning...\n";
28 +}
29 +
30 +my $git_work_tree = get_working_dir();
31 +
32 +my $retry = 1;
33 +
34 +my $json_pkg;
35 +eval {
36 + require JSON::XS;
37 + $json_pkg = "JSON::XS";
38 + 1;
39 +} or do {
40 + require JSON::PP;
41 + $json_pkg = "JSON::PP";
42 +};
43 +
44 +launch_watchman();
45 +
46 +sub launch_watchman {
47 + my $o = watchman_query();
48 + if (is_work_tree_watched($o)) {
49 + output_result($o->{clock}, @{$o->{files}});
50 + }
51 +}
52 +
53 +sub output_result {
54 + my ($clockid, @files) = @_;
55 +
56 + # Uncomment for debugging watchman output
57 + # open (my $fh, ">", ".git/watchman-output.out");
58 + # binmode $fh, ":utf8";
59 + # print $fh "$clockid\n@files\n";
60 + # close $fh;
61 +
62 + binmode STDOUT, ":utf8";
63 + print $clockid;
64 + print "\0";
65 + local $, = "\0";
66 + print @files;
67 +}
68 +
69 +sub watchman_clock {
70 + my $response = qx/watchman clock "$git_work_tree"/;
71 + die "Failed to get clock id on '$git_work_tree'.\n" .
72 + "Falling back to scanning...\n" if $? != 0;
73 +
74 + return $json_pkg->new->utf8->decode($response);
75 +}
76 +
77 +sub watchman_query {
78 + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
79 + or die "open2() failed: $!\n" .
80 + "Falling back to scanning...\n";
81 +
82 + # In the query expression below we're asking for names of files that
83 + # changed since $last_update_token but not from the .git folder.
84 + #
85 + # To accomplish this, we're using the "since" generator to use the
86 + # recency index to select candidate nodes and "fields" to limit the
87 + # output to file names only. Then we're using the "expression" term to
88 + # further constrain the results.
89 + my $last_update_line = "";
90 + if (substr($last_update_token, 0, 1) eq "c") {
91 + $last_update_token = "\"$last_update_token\"";
92 + $last_update_line = qq[\n"since": $last_update_token,];
93 + }
94 + my $query = <<" END";
95 + ["query", "$git_work_tree", {$last_update_line
96 + "fields": ["name"],
97 + "expression": ["not", ["dirname", ".git"]]
98 + }]
99 + END
100 +
101 + # Uncomment for debugging the watchman query
102 + # open (my $fh, ">", ".git/watchman-query.json");
103 + # print $fh $query;
104 + # close $fh;
105 +
106 + print CHLD_IN $query;
107 + close CHLD_IN;
108 + my $response = do {local $/; <CHLD_OUT>};
109 +
110 + # Uncomment for debugging the watch response
111 + # open ($fh, ">", ".git/watchman-response.json");
112 + # print $fh $response;
113 + # close $fh;
114 +
115 + die "Watchman: command returned no output.\n" .
116 + "Falling back to scanning...\n" if $response eq "";
117 + die "Watchman: command returned invalid output: $response\n" .
118 + "Falling back to scanning...\n" unless $response =~ /^\{/;
119 +
120 + return $json_pkg->new->utf8->decode($response);
121 +}
122 +
123 +sub is_work_tree_watched {
124 + my ($output) = @_;
125 + my $error = $output->{error};
126 + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
127 + $retry--;
128 + my $response = qx/watchman watch "$git_work_tree"/;
129 + die "Failed to make watchman watch '$git_work_tree'.\n" .
130 + "Falling back to scanning...\n" if $? != 0;
131 + $output = $json_pkg->new->utf8->decode($response);
132 + $error = $output->{error};
133 + die "Watchman: $error.\n" .
134 + "Falling back to scanning...\n" if $error;
135 +
136 + # Uncomment for debugging watchman output
137 + # open (my $fh, ">", ".git/watchman-output.out");
138 + # close $fh;
139 +
140 + # Watchman will always return all files on the first query so
141 + # return the fast "everything is dirty" flag to git and do the
142 + # Watchman query just to get it over with now so we won't pay
143 + # the cost in git to look up each individual file.
144 + my $o = watchman_clock();
145 + $error = $output->{error};
146 +
147 + die "Watchman: $error.\n" .
148 + "Falling back to scanning...\n" if $error;
149 +
150 + output_result($o->{clock}, ("/"));
151 + $last_update_token = $o->{clock};
152 +
153 + eval { launch_watchman() };
154 + return 0;
155 + }
156 +
157 + die "Watchman: $error.\n" .
158 + "Falling back to scanning...\n" if $error;
159 +
160 + return 1;
161 +}
162 +
163 +sub get_working_dir {
164 + my $working_dir;
165 + if ($^O =~ 'msys' || $^O =~ 'cygwin') {
166 + $working_dir = Win32::GetCwd();
167 + $working_dir =~ tr/\\/\//;
168 + } else {
169 + require Cwd;
170 + $working_dir = Cwd::cwd();
171 + }
172 +
173 + return $working_dir;
174 +}
1 +#!/bin/sh
2 +#
3 +# An example hook script to prepare a packed repository for use over
4 +# dumb transports.
5 +#
6 +# To enable this hook, rename this file to "post-update".
7 +
8 +exec git update-server-info
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed
4 +# by applypatch from an e-mail message.
5 +#
6 +# The hook should exit with non-zero status after issuing an
7 +# appropriate message if it wants to stop the commit.
8 +#
9 +# To enable this hook, rename this file to "pre-applypatch".
10 +
11 +. git-sh-setup
12 +precommit="$(git rev-parse --git-path hooks/pre-commit)"
13 +test -x "$precommit" && exec "$precommit" ${1+"$@"}
14 +:
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed.
4 +# Called by "git commit" with no arguments. The hook should
5 +# exit with non-zero status after issuing an appropriate message if
6 +# it wants to stop the commit.
7 +#
8 +# To enable this hook, rename this file to "pre-commit".
9 +
10 +if git rev-parse --verify HEAD >/dev/null 2>&1
11 +then
12 + against=HEAD
13 +else
14 + # Initial commit: diff against an empty tree object
15 + against=$(git hash-object -t tree /dev/null)
16 +fi
17 +
18 +# If you want to allow non-ASCII filenames set this variable to true.
19 +allownonascii=$(git config --type=bool hooks.allownonascii)
20 +
21 +# Redirect output to stderr.
22 +exec 1>&2
23 +
24 +# Cross platform projects tend to avoid non-ASCII filenames; prevent
25 +# them from being added to the repository. We exploit the fact that the
26 +# printable range starts at the space character and ends with tilde.
27 +if [ "$allownonascii" != "true" ] &&
28 + # Note that the use of brackets around a tr range is ok here, (it's
29 + # even required, for portability to Solaris 10's /usr/bin/tr), since
30 + # the square bracket bytes happen to fall in the designated range.
31 + test $(git diff --cached --name-only --diff-filter=A -z $against |
32 + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
33 +then
34 + cat <<\EOF
35 +Error: Attempt to add a non-ASCII file name.
36 +
37 +This can cause problems if you want to work with people on other platforms.
38 +
39 +To be portable it is advisable to rename the file.
40 +
41 +If you know what you are doing you can disable this check using:
42 +
43 + git config hooks.allownonascii true
44 +EOF
45 + exit 1
46 +fi
47 +
48 +# If there are whitespace errors, print the offending file names and fail.
49 +exec git diff-index --check --cached $against --
1 +#!/bin/sh
2 +#
3 +# An example hook script to verify what is about to be committed.
4 +# Called by "git merge" with no arguments. The hook should
5 +# exit with non-zero status after issuing an appropriate message to
6 +# stderr if it wants to stop the merge commit.
7 +#
8 +# To enable this hook, rename this file to "pre-merge-commit".
9 +
10 +. git-sh-setup
11 +test -x "$GIT_DIR/hooks/pre-commit" &&
12 + exec "$GIT_DIR/hooks/pre-commit"
13 +:
1 +#!/bin/sh
2 +
3 +# An example hook script to verify what is about to be pushed. Called by "git
4 +# push" after it has checked the remote status, but before anything has been
5 +# pushed. If this script exits with a non-zero status nothing will be pushed.
6 +#
7 +# This hook is called with the following parameters:
8 +#
9 +# $1 -- Name of the remote to which the push is being done
10 +# $2 -- URL to which the push is being done
11 +#
12 +# If pushing without using a named remote those arguments will be equal.
13 +#
14 +# Information about the commits which are being pushed is supplied as lines to
15 +# the standard input in the form:
16 +#
17 +# <local ref> <local oid> <remote ref> <remote oid>
18 +#
19 +# This sample shows how to prevent push of commits where the log message starts
20 +# with "WIP" (work in progress).
21 +
22 +remote="$1"
23 +url="$2"
24 +
25 +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
26 +
27 +while read local_ref local_oid remote_ref remote_oid
28 +do
29 + if test "$local_oid" = "$zero"
30 + then
31 + # Handle delete
32 + :
33 + else
34 + if test "$remote_oid" = "$zero"
35 + then
36 + # New branch, examine all commits
37 + range="$local_oid"
38 + else
39 + # Update to existing branch, examine new commits
40 + range="$remote_oid..$local_oid"
41 + fi
42 +
43 + # Check for WIP commit
44 + commit=$(git rev-list -n 1 --grep '^WIP' "$range")
45 + if test -n "$commit"
46 + then
47 + echo >&2 "Found WIP commit in $local_ref, not pushing"
48 + exit 1
49 + fi
50 + fi
51 +done
52 +
53 +exit 0
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2006, 2008 Junio C Hamano
4 +#
5 +# The "pre-rebase" hook is run just before "git rebase" starts doing
6 +# its job, and can prevent the command from running by exiting with
7 +# non-zero status.
8 +#
9 +# The hook is called with the following parameters:
10 +#
11 +# $1 -- the upstream the series was forked from.
12 +# $2 -- the branch being rebased (or empty when rebasing the current branch).
13 +#
14 +# This sample shows how to prevent topic branches that are already
15 +# merged to 'next' branch from getting rebased, because allowing it
16 +# would result in rebasing already published history.
17 +
18 +publish=next
19 +basebranch="$1"
20 +if test "$#" = 2
21 +then
22 + topic="refs/heads/$2"
23 +else
24 + topic=`git symbolic-ref HEAD` ||
25 + exit 0 ;# we do not interrupt rebasing detached HEAD
26 +fi
27 +
28 +case "$topic" in
29 +refs/heads/??/*)
30 + ;;
31 +*)
32 + exit 0 ;# we do not interrupt others.
33 + ;;
34 +esac
35 +
36 +# Now we are dealing with a topic branch being rebased
37 +# on top of master. Is it OK to rebase it?
38 +
39 +# Does the topic really exist?
40 +git show-ref -q "$topic" || {
41 + echo >&2 "No such branch $topic"
42 + exit 1
43 +}
44 +
45 +# Is topic fully merged to master?
46 +not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
47 +if test -z "$not_in_master"
48 +then
49 + echo >&2 "$topic is fully merged to master; better remove it."
50 + exit 1 ;# we could allow it, but there is no point.
51 +fi
52 +
53 +# Is topic ever merged to next? If so you should not be rebasing it.
54 +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
55 +only_next_2=`git rev-list ^master ${publish} | sort`
56 +if test "$only_next_1" = "$only_next_2"
57 +then
58 + not_in_topic=`git rev-list "^$topic" master`
59 + if test -z "$not_in_topic"
60 + then
61 + echo >&2 "$topic is already up to date with master"
62 + exit 1 ;# we could allow it, but there is no point.
63 + else
64 + exit 0
65 + fi
66 +else
67 + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
68 + /usr/bin/perl -e '
69 + my $topic = $ARGV[0];
70 + my $msg = "* $topic has commits already merged to public branch:\n";
71 + my (%not_in_next) = map {
72 + /^([0-9a-f]+) /;
73 + ($1 => 1);
74 + } split(/\n/, $ARGV[1]);
75 + for my $elem (map {
76 + /^([0-9a-f]+) (.*)$/;
77 + [$1 => $2];
78 + } split(/\n/, $ARGV[2])) {
79 + if (!exists $not_in_next{$elem->[0]}) {
80 + if ($msg) {
81 + print STDERR $msg;
82 + undef $msg;
83 + }
84 + print STDERR " $elem->[1]\n";
85 + }
86 + }
87 + ' "$topic" "$not_in_next" "$not_in_master"
88 + exit 1
89 +fi
90 +
91 +<<\DOC_END
92 +
93 +This sample hook safeguards topic branches that have been
94 +published from being rewound.
95 +
96 +The workflow assumed here is:
97 +
98 + * Once a topic branch forks from "master", "master" is never
99 + merged into it again (either directly or indirectly).
100 +
101 + * Once a topic branch is fully cooked and merged into "master",
102 + it is deleted. If you need to build on top of it to correct
103 + earlier mistakes, a new topic branch is created by forking at
104 + the tip of the "master". This is not strictly necessary, but
105 + it makes it easier to keep your history simple.
106 +
107 + * Whenever you need to test or publish your changes to topic
108 + branches, merge them into "next" branch.
109 +
110 +The script, being an example, hardcodes the publish branch name
111 +to be "next", but it is trivial to make it configurable via
112 +$GIT_DIR/config mechanism.
113 +
114 +With this workflow, you would want to know:
115 +
116 +(1) ... if a topic branch has ever been merged to "next". Young
117 + topic branches can have stupid mistakes you would rather
118 + clean up before publishing, and things that have not been
119 + merged into other branches can be easily rebased without
120 + affecting other people. But once it is published, you would
121 + not want to rewind it.
122 +
123 +(2) ... if a topic branch has been fully merged to "master".
124 + Then you can delete it. More importantly, you should not
125 + build on top of it -- other people may already want to
126 + change things related to the topic as patches against your
127 + "master", so if you need further changes, it is better to
128 + fork the topic (perhaps with the same name) afresh from the
129 + tip of "master".
130 +
131 +Let's look at this example:
132 +
133 + o---o---o---o---o---o---o---o---o---o "next"
134 + / / / /
135 + / a---a---b A / /
136 + / / / /
137 + / / c---c---c---c B /
138 + / / / \ /
139 + / / / b---b C \ /
140 + / / / / \ /
141 + ---o---o---o---o---o---o---o---o---o---o---o "master"
142 +
143 +
144 +A, B and C are topic branches.
145 +
146 + * A has one fix since it was merged up to "next".
147 +
148 + * B has finished. It has been fully merged up to "master" and "next",
149 + and is ready to be deleted.
150 +
151 + * C has not merged to "next" at all.
152 +
153 +We would want to allow C to be rebased, refuse A, and encourage
154 +B to be deleted.
155 +
156 +To compute (1):
157 +
158 + git rev-list ^master ^topic next
159 + git rev-list ^master next
160 +
161 + if these match, topic has not merged in next at all.
162 +
163 +To compute (2):
164 +
165 + git rev-list master..topic
166 +
167 + if this is empty, it is fully merged to "master".
168 +
169 +DOC_END
1 +#!/bin/sh
2 +#
3 +# An example hook script to make use of push options.
4 +# The example simply echoes all push options that start with 'echoback='
5 +# and rejects all pushes when the "reject" push option is used.
6 +#
7 +# To enable this hook, rename this file to "pre-receive".
8 +
9 +if test -n "$GIT_PUSH_OPTION_COUNT"
10 +then
11 + i=0
12 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
13 + do
14 + eval "value=\$GIT_PUSH_OPTION_$i"
15 + case "$value" in
16 + echoback=*)
17 + echo "echo from the pre-receive-hook: ${value#*=}" >&2
18 + ;;
19 + reject)
20 + exit 1
21 + esac
22 + i=$((i + 1))
23 + done
24 +fi
1 +#!/bin/sh
2 +#
3 +# An example hook script to prepare the commit log message.
4 +# Called by "git commit" with the name of the file that has the
5 +# commit message, followed by the description of the commit
6 +# message's source. The hook's purpose is to edit the commit
7 +# message file. If the hook fails with a non-zero status,
8 +# the commit is aborted.
9 +#
10 +# To enable this hook, rename this file to "prepare-commit-msg".
11 +
12 +# This hook includes three examples. The first one removes the
13 +# "# Please enter the commit message..." help message.
14 +#
15 +# The second includes the output of "git diff --name-status -r"
16 +# into the message, just before the "git status" output. It is
17 +# commented because it doesn't cope with --amend or with squashed
18 +# commits.
19 +#
20 +# The third example adds a Signed-off-by line to the message, that can
21 +# still be edited. This is rarely a good idea.
22 +
23 +COMMIT_MSG_FILE=$1
24 +COMMIT_SOURCE=$2
25 +SHA1=$3
26 +
27 +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
28 +
29 +# case "$COMMIT_SOURCE,$SHA1" in
30 +# ,|template,)
31 +# /usr/bin/perl -i.bak -pe '
32 +# print "\n" . `git diff --cached --name-status -r`
33 +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
34 +# *) ;;
35 +# esac
36 +
37 +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
38 +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
39 +# if test -z "$COMMIT_SOURCE"
40 +# then
41 +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
42 +# fi
1 +#!/bin/sh
2 +
3 +# An example hook script to update a checked-out tree on a git push.
4 +#
5 +# This hook is invoked by git-receive-pack(1) when it reacts to git
6 +# push and updates reference(s) in its repository, and when the push
7 +# tries to update the branch that is currently checked out and the
8 +# receive.denyCurrentBranch configuration variable is set to
9 +# updateInstead.
10 +#
11 +# By default, such a push is refused if the working tree and the index
12 +# of the remote repository has any difference from the currently
13 +# checked out commit; when both the working tree and the index match
14 +# the current commit, they are updated to match the newly pushed tip
15 +# of the branch. This hook is to be used to override the default
16 +# behaviour; however the code below reimplements the default behaviour
17 +# as a starting point for convenient modification.
18 +#
19 +# The hook receives the commit with which the tip of the current
20 +# branch is going to be updated:
21 +commit=$1
22 +
23 +# It can exit with a non-zero status to refuse the push (when it does
24 +# so, it must not modify the index or the working tree).
25 +die () {
26 + echo >&2 "$*"
27 + exit 1
28 +}
29 +
30 +# Or it can make any necessary changes to the working tree and to the
31 +# index to bring them to the desired state when the tip of the current
32 +# branch is updated to the new commit, and exit with a zero status.
33 +#
34 +# For example, the hook can simply run git read-tree -u -m HEAD "$1"
35 +# in order to emulate git fetch that is run in the reverse direction
36 +# with git push, as the two-tree form of git read-tree -u -m is
37 +# essentially the same as git switch or git checkout that switches
38 +# branches while keeping the local changes in the working tree that do
39 +# not interfere with the difference between the branches.
40 +
41 +# The below is a more-or-less exact translation to shell of the C code
42 +# for the default behaviour for git's push-to-checkout hook defined in
43 +# the push_to_deploy() function in builtin/receive-pack.c.
44 +#
45 +# Note that the hook will be executed from the repository directory,
46 +# not from the working tree, so if you want to perform operations on
47 +# the working tree, you will have to adapt your code accordingly, e.g.
48 +# by adding "cd .." or using relative paths.
49 +
50 +if ! git update-index -q --ignore-submodules --refresh
51 +then
52 + die "Up-to-date check failed"
53 +fi
54 +
55 +if ! git diff-files --quiet --ignore-submodules --
56 +then
57 + die "Working directory has unstaged changes"
58 +fi
59 +
60 +# This is a rough translation of:
61 +#
62 +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
63 +if git cat-file -e HEAD 2>/dev/null
64 +then
65 + head=HEAD
66 +else
67 + head=$(git hash-object -t tree --stdin </dev/null)
68 +fi
69 +
70 +if ! git diff-index --quiet --cached --ignore-submodules $head --
71 +then
72 + die "Working directory has staged changes"
73 +fi
74 +
75 +if ! git read-tree -u -m "$commit"
76 +then
77 + die "Could not update working tree to new HEAD"
78 +fi
1 +#!/bin/sh
2 +#
3 +# An example hook script to block unannotated tags from entering.
4 +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
5 +#
6 +# To enable this hook, rename this file to "update".
7 +#
8 +# Config
9 +# ------
10 +# hooks.allowunannotated
11 +# This boolean sets whether unannotated tags will be allowed into the
12 +# repository. By default they won't be.
13 +# hooks.allowdeletetag
14 +# This boolean sets whether deleting tags will be allowed in the
15 +# repository. By default they won't be.
16 +# hooks.allowmodifytag
17 +# This boolean sets whether a tag may be modified after creation. By default
18 +# it won't be.
19 +# hooks.allowdeletebranch
20 +# This boolean sets whether deleting branches will be allowed in the
21 +# repository. By default they won't be.
22 +# hooks.denycreatebranch
23 +# This boolean sets whether remotely creating branches will be denied
24 +# in the repository. By default this is allowed.
25 +#
26 +
27 +# --- Command line
28 +refname="$1"
29 +oldrev="$2"
30 +newrev="$3"
31 +
32 +# --- Safety check
33 +if [ -z "$GIT_DIR" ]; then
34 + echo "Don't run this script from the command line." >&2
35 + echo " (if you want, you could supply GIT_DIR then run" >&2
36 + echo " $0 <ref> <oldrev> <newrev>)" >&2
37 + exit 1
38 +fi
39 +
40 +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
41 + echo "usage: $0 <ref> <oldrev> <newrev>" >&2
42 + exit 1
43 +fi
44 +
45 +# --- Config
46 +allowunannotated=$(git config --type=bool hooks.allowunannotated)
47 +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
48 +denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
49 +allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
50 +allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
51 +
52 +# check for no description
53 +projectdesc=$(sed -e '1q' "$GIT_DIR/description")
54 +case "$projectdesc" in
55 +"Unnamed repository"* | "")
56 + echo "*** Project description file hasn't been set" >&2
57 + exit 1
58 + ;;
59 +esac
60 +
61 +# --- Check types
62 +# if $newrev is 0000...0000, it's a commit to delete a ref.
63 +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
64 +if [ "$newrev" = "$zero" ]; then
65 + newrev_type=delete
66 +else
67 + newrev_type=$(git cat-file -t $newrev)
68 +fi
69 +
70 +case "$refname","$newrev_type" in
71 + refs/tags/*,commit)
72 + # un-annotated tag
73 + short_refname=${refname##refs/tags/}
74 + if [ "$allowunannotated" != "true" ]; then
75 + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
76 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
77 + exit 1
78 + fi
79 + ;;
80 + refs/tags/*,delete)
81 + # delete tag
82 + if [ "$allowdeletetag" != "true" ]; then
83 + echo "*** Deleting a tag is not allowed in this repository" >&2
84 + exit 1
85 + fi
86 + ;;
87 + refs/tags/*,tag)
88 + # annotated tag
89 + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
90 + then
91 + echo "*** Tag '$refname' already exists." >&2
92 + echo "*** Modifying a tag is not allowed in this repository." >&2
93 + exit 1
94 + fi
95 + ;;
96 + refs/heads/*,commit)
97 + # branch
98 + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
99 + echo "*** Creating a branch is not allowed in this repository" >&2
100 + exit 1
101 + fi
102 + ;;
103 + refs/heads/*,delete)
104 + # delete branch
105 + if [ "$allowdeletebranch" != "true" ]; then
106 + echo "*** Deleting a branch is not allowed in this repository" >&2
107 + exit 1
108 + fi
109 + ;;
110 + refs/remotes/*,commit)
111 + # tracking branch
112 + ;;
113 + refs/remotes/*,delete)
114 + # delete tracking branch
115 + if [ "$allowdeletebranch" != "true" ]; then
116 + echo "*** Deleting a tracking branch is not allowed in this repository" >&2
117 + exit 1
118 + fi
119 + ;;
120 + *)
121 + # Anything else (is there anything else?)
122 + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
123 + exit 1
124 + ;;
125 +esac
126 +
127 +# --- Finished
128 +exit 0
1 +# git ls-files --others --exclude-from=.git/info/exclude
2 +# Lines that start with '#' are comments.
3 +# For a project mostly in C, the following would be a good set of
4 +# exclude patterns (uncomment them if you want to use them):
5 +# *.[oa]
6 +# *~
1 +# pack-refs with: peeled fully-peeled sorted
2 +0ce6a159e4e0aa1eba1eb8c09499302a9c62d74f refs/heads/feature/allow-structs-as-sender
3 +a30ff35e616f507d8a8d122dac32a2150371a87e refs/heads/master
4 +276e13088358d534ec2b6af5a9cdc6b29f13b82f refs/heads/revert-47-master
5 +e4e8d93de0da1145bc5cd321a335e903f2ab0c9e refs/pull/13/head
6 +40da1a6aa4edb45f4a13f7f5a9602eaf1e984ba4 refs/pull/16/head
7 +28300d1cdc1e92f372bcd60e704a234f30f2085f refs/pull/18/head
8 +e051a643d52118387bb5d0f84430e3c54a9fdd45 refs/pull/20/head
9 +53aecbef63b3635be01a3c6b4caa666e33533ce7 refs/pull/21/head
10 +05ac44912160207058d2193421e4d0be40368158 refs/pull/23/head
11 +fb0e021acf449af4dbec3478e23abe8097904efd refs/pull/24/head
12 +61da869aa74e03a89e854f2e55d2d16fcbcc844d refs/pull/3/head
13 +6a09b33a22303065b0b2350182b2a5834cacf778 refs/pull/34/head
14 +d09b4320b64e82853e83975817384ac96da1a066 refs/pull/36/head
15 +ab2af426b3a340d329090b242869d0ea4c660eba refs/pull/45/head
16 +a2b1d3dfdb3c7a8a828d60e1b869a721e8b1ab1b refs/pull/46/head
17 +b0cce4977fc0e23da1004446d7ec6f7f9706f1d5 refs/pull/47/head
18 +1ab88a1f6eaf1877b1bf8ed670e2681dc1455caf refs/pull/51/head
19 +8fdb6e8f41891acdceaec768bc06d6faa9fa128b refs/pull/54/head
20 +e31bd014cc991232cd5ea677499309f3ad9122f9 refs/pull/6/head
21 +ab2a23532cd6a59994e80ae3c987d0001165d29c refs/pull/7/head
22 +a3c42b4f0c50672167fbe47be4151a29c7cc204d refs/pull/7/merge
23 +aa5f21eff0588e015f89aa9178f76dd5d79be5d7 refs/pull/8/head
24 +e3fba8129c4dfbe46e0ed2316b57f3eaa39aabb8 refs/pull/9/head
25 +149349d0d6d527ecbec4b54f0ede576fc53e6797 refs/pull/9/merge
26 +2510df2e742030c0df3083dd85b5ef35dd5af67d refs/tags/1.0.0
27 +^9a16d7daa889dd3cfdbed0f437142b6bf8c02548
28 +a161c251f10fcd18742b1b544e200d0c949adcb3 refs/tags/1.1.0
29 +^4b8cbb5a8227b3c29af75e0416689d26178733d8
30 +be2cbe06b7fda3d86971893ceee64984dc538626 refs/tags/2.0.0
31 +^768f1b856fc8d50948905e491aef6aab94ac8478
32 +f92b6243116f2332b6bbb3a8b81f7bfdaa311251 refs/tags/2.0.1
33 +^d03d83b8a1a591fe48138a04eee352ef76130c72
34 +4c6e14084affc79f327fa588505ecfc2a03b3870 refs/tags/2.0.2
35 +^f47ce7acf2999d7d1d0ed759553c54e96db12341
36 +a727cea7caefea3f29de42f9fa995c10b95ad246 refs/tags/2.1.0
37 +^6d9a022cdeaba45546c1eca0b8b880068ae708d2
38 +9cfef1d3a33412a42b648ef384d214b555b76d59 refs/tags/2.1.1
39 +^dd8cd537e4e89e204cde263351d33a99590c9572
40 +917ae5666ff0f6a1247a5d58f3029e60dff9c4d0 refs/tags/2.1.2
41 +^5798bb55a16602b263e67fad95140d29bc93ebb3
42 +efab81530999fe9939fc78df7fbddd228f7bb588 refs/tags/2.2.0
43 +^0346d72aaaae72484001d45a29c484635a91de9c
44 +5473005cc6027e644291a4931ae7addb7b37a2c3 refs/tags/3.0.0
45 +^13f6323427b0672493d690fff5798b459e4bd28c
46 +60ec5d415f05b9036ce77af9dccffdc17eab18bf refs/tags/3.0.1
47 +^4b1af9e8f0034914971dd8accf1113832a6ed661
48 +f66223012e8143fa4a37cd61c59a2cb8cb409afe refs/tags/5.0.0
49 +^68ffd9853630937506984d46ffbb69b567691d6f
50 +d1516f096198824a3d06c2d201bc1cf9fc15a42d refs/tags/5.0.1
51 +^cea5121162d88f233f392f63acbc8468fdd77927
52 +eb98b9baecfdc0102e4bde2a2e592f2168fad291 refs/tags/5.1.0
53 +^a30ff35e616f507d8a8d122dac32a2150371a87e
1 +f0c10a622f1a5ea8818aa02935f874da2dcb8c7e
1 +{
2 + "object" : {
3 + "artifacts" : [
4 +
5 + ],
6 + "dependencies" : [
7 + {
8 + "basedOn" : null,
9 + "packageRef" : {
10 + "identity" : "rsbarcodes_swift",
11 + "kind" : "remoteSourceControl",
12 + "location" : "https://github.com/yeahdongcn/RSBarcodes_Swift.git",
13 + "name" : "RSBarcodes_Swift"
14 + },
15 + "state" : {
16 + "checkoutState" : {
17 + "revision" : "241de72a96f49b1545d5de3c00fae170c2675c41",
18 + "version" : "5.2.0"
19 + },
20 + "name" : "sourceControlCheckout"
21 + },
22 + "subpath" : "RSBarcodes_Swift"
23 + },
24 + {
25 + "basedOn" : null,
26 + "packageRef" : {
27 + "identity" : "swifteventbus",
28 + "kind" : "remoteSourceControl",
29 + "location" : "https://github.com/cesarferreira/SwiftEventBus.git",
30 + "name" : "SwiftEventBus"
31 + },
32 + "state" : {
33 + "checkoutState" : {
34 + "revision" : "a30ff35e616f507d8a8d122dac32a2150371a87e",
35 + "version" : "5.1.0"
36 + },
37 + "name" : "sourceControlCheckout"
38 + },
39 + "subpath" : "SwiftEventBus"
40 + }
41 + ]
42 + },
43 + "version" : 6
44 +}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.