githug 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/README.md +90 -0
- data/Rakefile +1 -0
- data/bin/githug +4 -0
- data/githug.gemspec +27 -0
- data/levels/add.rb +17 -0
- data/levels/blame.rb +20 -0
- data/levels/blame/.githug/COMMIT_EDITMSG +1 -0
- data/levels/blame/.githug/HEAD +1 -0
- data/levels/blame/.githug/config +5 -0
- data/levels/blame/.githug/description +1 -0
- data/levels/blame/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/blame/.githug/hooks/commit-msg.sample +24 -0
- data/levels/blame/.githug/hooks/post-commit.sample +8 -0
- data/levels/blame/.githug/hooks/post-receive.sample +15 -0
- data/levels/blame/.githug/hooks/post-update.sample +8 -0
- data/levels/blame/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/blame/.githug/hooks/pre-commit.sample +46 -0
- data/levels/blame/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/blame/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/blame/.githug/hooks/update.sample +128 -0
- data/levels/blame/.githug/index +0 -0
- data/levels/blame/.githug/info/exclude +6 -0
- data/levels/blame/.githug/logs/HEAD +5 -0
- data/levels/blame/.githug/logs/refs/heads/master +5 -0
- data/levels/blame/.githug/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 +0 -0
- data/levels/blame/.githug/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 +0 -0
- data/levels/blame/.githug/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 +2 -0
- data/levels/blame/.githug/objects/21/15d78864000292628872941b14521f90187eed +0 -0
- data/levels/blame/.githug/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 +2 -0
- data/levels/blame/.githug/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 +0 -0
- data/levels/blame/.githug/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e +0 -0
- data/levels/blame/.githug/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba +0 -0
- data/levels/blame/.githug/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed +0 -0
- data/levels/blame/.githug/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 +1 -0
- data/levels/blame/.githug/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 +0 -0
- data/levels/blame/.githug/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f +0 -0
- data/levels/blame/.githug/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 +0 -0
- data/levels/blame/.githug/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 +4 -0
- data/levels/blame/.githug/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 +1 -0
- data/levels/blame/.githug/refs/heads/master +1 -0
- data/levels/blame/config.rb +16 -0
- data/levels/clone.rb +10 -0
- data/levels/clone_to_folder.rb +10 -0
- data/levels/commit.rb +17 -0
- data/levels/config.rb +28 -0
- data/levels/contribute.rb +25 -0
- data/levels/diff.rb +16 -0
- data/levels/diff/.githug/COMMIT_EDITMSG +1 -0
- data/levels/diff/.githug/HEAD +1 -0
- data/levels/diff/.githug/config +5 -0
- data/levels/diff/.githug/description +1 -0
- data/levels/diff/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/diff/.githug/hooks/commit-msg.sample +24 -0
- data/levels/diff/.githug/hooks/post-commit.sample +8 -0
- data/levels/diff/.githug/hooks/post-receive.sample +15 -0
- data/levels/diff/.githug/hooks/post-update.sample +8 -0
- data/levels/diff/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/diff/.githug/hooks/pre-commit.sample +46 -0
- data/levels/diff/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/diff/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/diff/.githug/hooks/update.sample +128 -0
- data/levels/diff/.githug/index +0 -0
- data/levels/diff/.githug/info/exclude +6 -0
- data/levels/diff/.githug/logs/HEAD +1 -0
- data/levels/diff/.githug/logs/refs/heads/master +1 -0
- data/levels/diff/.githug/objects/1b/6582364621c92707b587409cedbc4f77fc0cee +0 -0
- data/levels/diff/.githug/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d +2 -0
- data/levels/diff/.githug/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 +3 -0
- data/levels/diff/.githug/refs/heads/master +1 -0
- data/levels/diff/app.rb +42 -0
- data/levels/init.rb +10 -0
- data/levels/status.rb +26 -0
- data/lib/githug.rb +11 -0
- data/lib/githug/cli.rb +68 -0
- data/lib/githug/game.rb +40 -0
- data/lib/githug/level.rb +83 -0
- data/lib/githug/profile.rb +41 -0
- data/lib/githug/repository.rb +42 -0
- data/lib/githug/ui.rb +73 -0
- data/lib/githug/version.rb +3 -0
- data/spec/githug/cli_spec.rb +80 -0
- data/spec/githug/game_spec.rb +56 -0
- data/spec/githug/level_spec.rb +131 -0
- data/spec/githug/profile_spec.rb +36 -0
- data/spec/githug/repository_spec.rb +98 -0
- data/spec/githug/ui_spec.rb +84 -0
- data/spec/spec_helper.rb +1 -0
- metadata +178 -0
@@ -0,0 +1,36 @@
|
|
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 comments out the
|
13
|
+
# "Conflicts:" part of a merge commit.
|
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
|
+
case "$2,$3" in
|
24
|
+
merge,)
|
25
|
+
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
26
|
+
|
27
|
+
# ,|template,)
|
28
|
+
# /usr/bin/perl -i.bak -pe '
|
29
|
+
# print "\n" . `git diff --cached --name-status -r`
|
30
|
+
# if /^#/ && $first++ == 0' "$1" ;;
|
31
|
+
|
32
|
+
*) ;;
|
33
|
+
esac
|
34
|
+
|
35
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
36
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to blocks 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 --bool hooks.allowunannotated)
|
47
|
+
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
48
|
+
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
49
|
+
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
50
|
+
allowmodifytag=$(git config --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="0000000000000000000000000000000000000000"
|
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
|
Binary file
|
@@ -0,0 +1,5 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5e8863df752e3b7f2150df7c78f12bef6f1ff00e Gary Rennie <webmaster@gazler.com> 1331247924 +0000 commit (initial): added config with name
|
2
|
+
5e8863df752e3b7f2150df7c78f12bef6f1ff00e 094094808dc6dc336c93c8602190a9e5f7bd6a11 Spider Man <spidey-sense@tingling.com> 1331247978 +0000 commit: added options
|
3
|
+
094094808dc6dc336c93c8602190a9e5f7bd6a11 70d00535a3a25b0ac1736dd3d306d6271e5427ed Bruce Banner <hulk@smash.com> 1331248061 +0000 commit: added password
|
4
|
+
70d00535a3a25b0ac1736dd3d306d6271e5427ed 97bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 Spider Man <spidey-sense@tingling.com> 1331248095 +0000 commit: added more options
|
5
|
+
97bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 ffd39c2dbfd94bdbca06d48686e0cbda642f3de7 Gary Rennie <webmaster@gazler.com> 1331248138 +0000 commit: added more options (no really)
|
@@ -0,0 +1,5 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5e8863df752e3b7f2150df7c78f12bef6f1ff00e Gary Rennie <webmaster@gazler.com> 1331247924 +0000 commit (initial): added config with name
|
2
|
+
5e8863df752e3b7f2150df7c78f12bef6f1ff00e 094094808dc6dc336c93c8602190a9e5f7bd6a11 Spider Man <spidey-sense@tingling.com> 1331247978 +0000 commit: added options
|
3
|
+
094094808dc6dc336c93c8602190a9e5f7bd6a11 70d00535a3a25b0ac1736dd3d306d6271e5427ed Bruce Banner <hulk@smash.com> 1331248061 +0000 commit: added password
|
4
|
+
70d00535a3a25b0ac1736dd3d306d6271e5427ed 97bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 Spider Man <spidey-sense@tingling.com> 1331248095 +0000 commit: added more options
|
5
|
+
97bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 ffd39c2dbfd94bdbca06d48686e0cbda642f3de7 Gary Rennie <webmaster@gazler.com> 1331248138 +0000 commit: added more options (no really)
|
@@ -0,0 +1 @@
|
|
1
|
+
x��Kj1D��S��$t��`L.�UN����i�(�>��((���-u��lͩ7U`"'!Fo�{�1p�4�uL? )U��ܴt(�θl2��B�x#�x��r��������6�����_��C��Z�ϡϥnW c�m���<@p���c�߇)���V�B��Z�1�n�K�
|
@@ -0,0 +1 @@
|
|
1
|
+
x��MJD1�]��t$�t`ܹ��NG�$C&"�������Ž�}���ix�|�ڠ�!搲���ٸ����1��Ґ6!.�53�X|��t �is���/Vo91[E?���q�Oim8�J�t�2���ʽ^�8g�G�^�Z���fيr���~�{o7xn��q�O�dbO[
|
@@ -0,0 +1 @@
|
|
1
|
+
ffd39c2dbfd94bdbca06d48686e0cbda642f3de7
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Config
|
2
|
+
attr_accessor :name, :password
|
3
|
+
def initialize(name, password = nil, options = {})
|
4
|
+
@name = name
|
5
|
+
@password = password || "i<3evil"
|
6
|
+
|
7
|
+
if options[:downcase]
|
8
|
+
@name.downcase!
|
9
|
+
end
|
10
|
+
|
11
|
+
if options[:upcase]
|
12
|
+
@name.upcase!
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/levels/clone.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "Clone the repository at https://github.com/Gazler/cloneme"
|
3
|
+
|
4
|
+
solution do
|
5
|
+
repo("cloneme").commit("157b2b61f29ab9df45f31c7cd9cb5d8ff06ecde4")
|
6
|
+
end
|
7
|
+
|
8
|
+
hint do
|
9
|
+
puts "You should have a look at this site: https://github.com/Gazler/cloneme"
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "Clone the repository at https://github.com/Gazler/cloneme to 'my_cloned_repo'"
|
3
|
+
|
4
|
+
solution do
|
5
|
+
repo("my_cloned_repo").commit("157b2b61f29ab9df45f31c7cd9cb5d8ff06ecde4")
|
6
|
+
end
|
7
|
+
|
8
|
+
hint do
|
9
|
+
puts "This is like the last level, git clone has an optional argument."
|
10
|
+
end
|
data/levels/commit.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "The README file has been added to your staging area, now commit it."
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
FileUtils.touch("README")
|
7
|
+
repo.add("README")
|
8
|
+
end
|
9
|
+
|
10
|
+
solution do
|
11
|
+
return false if repo.commits.empty?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
hint do
|
16
|
+
puts "You must include a message when you commit."
|
17
|
+
end
|
data/levels/config.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "Set up your git name and email, this is important so that your commits can be identified"
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
end
|
7
|
+
|
8
|
+
solution do
|
9
|
+
|
10
|
+
valid = false
|
11
|
+
|
12
|
+
name = request("What is your name?")
|
13
|
+
email = request("What is your email?")
|
14
|
+
config_name = repo.config["user.name"]
|
15
|
+
config_email = repo.config["user.email"]
|
16
|
+
if name == config_name && email == config_email
|
17
|
+
valid = true
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "Your config has the following name: #{config_name}"
|
21
|
+
puts "Your config has the following email: #{config_email}"
|
22
|
+
|
23
|
+
valid
|
24
|
+
end
|
25
|
+
|
26
|
+
hint do
|
27
|
+
puts "These settings are config settings. You should run `git help config` if you are stuck"
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
difficulty 3
|
2
|
+
description "Contribute to this repository by making a pull request on Github"
|
3
|
+
|
4
|
+
solution do
|
5
|
+
location = "/tmp/githug"
|
6
|
+
FileUtils.rm_rf(location)
|
7
|
+
puts "Cloning repository to #{location}"
|
8
|
+
`git clone git@github.com:Gazler/githug.git #{location}`
|
9
|
+
|
10
|
+
contributor = false
|
11
|
+
|
12
|
+
repo = Grit::Repo.new(location)
|
13
|
+
repo.commits('master', false).each do |commit|
|
14
|
+
if commit.author.name == repo.config["user.name"]
|
15
|
+
if commit.author.email == repo.config["user.email"]
|
16
|
+
contributor = true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
contributor
|
21
|
+
end
|
22
|
+
|
23
|
+
hint do
|
24
|
+
puts "Forking the repository would be a good start!"
|
25
|
+
end
|
data/levels/diff.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
difficulty 2
|
2
|
+
description "There have been modifications to the app.rb file since your last commit. Find out which line has changed."
|
3
|
+
|
4
|
+
setup do
|
5
|
+
init_from_level
|
6
|
+
end
|
7
|
+
|
8
|
+
solution do
|
9
|
+
line = request "What line has changed?"
|
10
|
+
return false unless line == "23"
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
hint do
|
15
|
+
puts "You are looking for the difference since your last commit. Don't forget that running `git` on its own will list the possible commands."
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
added app.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
ref: refs/heads/master
|
@@ -0,0 +1 @@
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
@@ -0,0 +1,15 @@
|
|
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
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
15
|
+
:
|
@@ -0,0 +1,24 @@
|
|
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
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script for the "post-receive" event.
|
4
|
+
#
|
5
|
+
# The "post-receive" script is run after receive-pack has accepted a pack
|
6
|
+
# and the repository has been updated. It is passed arguments in through
|
7
|
+
# stdin in the form
|
8
|
+
# <oldrev> <newrev> <refname>
|
9
|
+
# For example:
|
10
|
+
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
11
|
+
#
|
12
|
+
# see contrib/hooks/ for a sample, or uncomment the next line and
|
13
|
+
# rename the file to "post-receive".
|
14
|
+
|
15
|
+
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
|