githug 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +1 -0
- data/README.md +2 -4
- data/levels/commit_in_future.rb +19 -0
- data/levels/delete_branch.rb +15 -0
- data/levels/delete_branch/.githug/COMMIT_EDITMSG +1 -0
- data/levels/delete_branch/.githug/HEAD +1 -0
- data/levels/delete_branch/.githug/config +7 -0
- data/levels/delete_branch/.githug/description +1 -0
- data/levels/delete_branch/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/delete_branch/.githug/hooks/commit-msg.sample +24 -0
- data/levels/delete_branch/.githug/hooks/post-update.sample +8 -0
- data/levels/delete_branch/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/delete_branch/.githug/hooks/pre-commit.sample +49 -0
- data/levels/delete_branch/.githug/hooks/pre-push.sample +53 -0
- data/levels/delete_branch/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/delete_branch/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/delete_branch/.githug/hooks/update.sample +128 -0
- data/levels/delete_branch/.githug/index +0 -0
- data/levels/delete_branch/.githug/info/exclude +6 -0
- data/levels/delete_branch/.githug/logs/HEAD +4 -0
- data/levels/delete_branch/.githug/logs/refs/heads/delete_me +1 -0
- data/levels/delete_branch/.githug/logs/refs/heads/master +1 -0
- data/levels/delete_branch/.githug/objects/b6/0afe294eb3c200d646995c9e0234470157c1b0 +2 -0
- data/levels/delete_branch/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/levels/delete_branch/.githug/objects/e8/0ad49ace82167de62e498622d70377d913c79e +0 -0
- data/levels/delete_branch/.githug/refs/heads/delete_me +1 -0
- data/levels/delete_branch/.githug/refs/heads/master +1 -0
- data/levels/delete_branch/readme +0 -0
- data/levels/fetch.rb +70 -0
- data/levels/include.rb +21 -0
- data/levels/number_of_files_committed.rb +51 -0
- data/levels/push_branch.rb +87 -0
- data/levels/push_tags.rb +1 -1
- data/levels/restructure.rb +40 -0
- data/lib/githug/level.rb +9 -8
- data/lib/githug/ui.rb +1 -1
- data/lib/githug/version.rb +1 -1
- data/spec/githug_spec.rb +38 -0
- metadata +33 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a94e3f45e86a99703cd503e3fc9f7f7d8d0dc41f
|
4
|
+
data.tar.gz: bb3df4d8a23fc33c75b0b2d35bcdce7bfea96701
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0135f1e9543ca8a4b47c055a9e60208944ded20cd857ddd357263fc2268820c20d72d3b275a0f9db8e40db6a00b3c358d6b352a754d9474984b75f4fd562f3ce
|
7
|
+
data.tar.gz: 8113e0f346dd092f6b3e056c51ec8941084b602573a156b881d79cde62a50cda03e36a9c1eb8f93d89bd8b8051832eb587873624c5f6833af8d92ce560b0a1e0
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Githug
|
2
|
-
Git Your Game On [![Build Status](https://travis-ci.org/Gazler/githug.png?branch=master)](https://travis-ci.org/Gazler/githug)
|
3
|
-
|
2
|
+
Git Your Game On [![Build Status](https://travis-ci.org/Gazler/githug.png?branch=master)](https://travis-ci.org/Gazler/githug) [![Code Climate](https://codeclimate.com/github/Gazler/githug.png)](https://codeclimate.com/github/Gazler/githug)
|
4
3
|
## About
|
5
4
|
Githug is designed to give you a practical way of learning git. It has a series of levels, each utilizing git commands to ensure a correct answer.
|
6
5
|
|
@@ -40,7 +39,6 @@ If you want to suggest a level or make a level that has been suggested, check ou
|
|
40
39
|
|
41
40
|
## Todo List
|
42
41
|
|
43
|
-
* A better way of returning from the solution block
|
44
42
|
* A follow up to the level, more information on a specific command, etc.
|
45
43
|
* More levels!
|
46
44
|
|
@@ -113,7 +111,7 @@ After doing this, your level should be able to copy the contents from that git r
|
|
113
111
|
The easiest way to test a level is:
|
114
112
|
|
115
113
|
* change into your git_hug repository
|
116
|
-
* Run `githug
|
114
|
+
* Run `githug reset PATH_TO_YOUR_LEVEL`
|
117
115
|
* Solve the level
|
118
116
|
* Run `githug test PATH_TO_YOUR_LEVEL`
|
119
117
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
difficulty 2
|
4
|
+
description "Commit your changes with the future date (e.g. tomorrow)."
|
5
|
+
|
6
|
+
setup do
|
7
|
+
repo.init
|
8
|
+
|
9
|
+
FileUtils.touch("README")
|
10
|
+
repo.add("README")
|
11
|
+
end
|
12
|
+
|
13
|
+
solution do
|
14
|
+
repo.commits.length == 1 && repo.commits.first.authored_date > Time.now
|
15
|
+
end
|
16
|
+
|
17
|
+
hint do
|
18
|
+
puts "Build a time machine, move to the future and commit your changes, then go back and verify results ;)."
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
difficulty 2
|
2
|
+
|
3
|
+
description "You have created too many branches for your project. There is an old branch in your repo called 'delete_me', you should delete it."
|
4
|
+
|
5
|
+
setup do
|
6
|
+
init_from_level
|
7
|
+
end
|
8
|
+
|
9
|
+
solution do
|
10
|
+
return true unless repo.branches.map(&:name).include?('delete_me')
|
11
|
+
end
|
12
|
+
|
13
|
+
hint do
|
14
|
+
puts "Running 'git --help branch' will give you a list of branch commands."
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
delete_me branch
|
@@ -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,14 @@
|
|
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
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
14
|
+
:
|
@@ -0,0 +1,49 @@
|
|
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=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
16
|
+
fi
|
17
|
+
|
18
|
+
# If you want to allow non-ASCII filenames set this variable to true.
|
19
|
+
allownonascii=$(git config 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 --
|
@@ -0,0 +1,53 @@
|
|
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 sha1> <remote ref> <remote sha1>
|
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
|
+
z40=0000000000000000000000000000000000000000
|
26
|
+
|
27
|
+
IFS=' '
|
28
|
+
while read local_ref local_sha remote_ref remote_sha
|
29
|
+
do
|
30
|
+
if [ "$local_sha" = $z40 ]
|
31
|
+
then
|
32
|
+
# Handle delete
|
33
|
+
else
|
34
|
+
if [ "$remote_sha" = $z40 ]
|
35
|
+
then
|
36
|
+
# New branch, examine all commits
|
37
|
+
range="$local_sha"
|
38
|
+
else
|
39
|
+
# Update to existing branch, examine new commits
|
40
|
+
range="$remote_sha..$local_sha"
|
41
|
+
fi
|
42
|
+
|
43
|
+
# Check for WIP commit
|
44
|
+
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
45
|
+
if [ -n "$commit" ]
|
46
|
+
then
|
47
|
+
echo "Found WIP commit in $local_ref, not pushing"
|
48
|
+
exit 1
|
49
|
+
fi
|
50
|
+
fi
|
51
|
+
done
|
52
|
+
|
53
|
+
exit 0
|
@@ -0,0 +1,169 @@
|
|
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
|
+
exit 0
|
92
|
+
|
93
|
+
################################################################
|
94
|
+
|
95
|
+
This sample hook safeguards topic branches that have been
|
96
|
+
published from being rewound.
|
97
|
+
|
98
|
+
The workflow assumed here is:
|
99
|
+
|
100
|
+
* Once a topic branch forks from "master", "master" is never
|
101
|
+
merged into it again (either directly or indirectly).
|
102
|
+
|
103
|
+
* Once a topic branch is fully cooked and merged into "master",
|
104
|
+
it is deleted. If you need to build on top of it to correct
|
105
|
+
earlier mistakes, a new topic branch is created by forking at
|
106
|
+
the tip of the "master". This is not strictly necessary, but
|
107
|
+
it makes it easier to keep your history simple.
|
108
|
+
|
109
|
+
* Whenever you need to test or publish your changes to topic
|
110
|
+
branches, merge them into "next" branch.
|
111
|
+
|
112
|
+
The script, being an example, hardcodes the publish branch name
|
113
|
+
to be "next", but it is trivial to make it configurable via
|
114
|
+
$GIT_DIR/config mechanism.
|
115
|
+
|
116
|
+
With this workflow, you would want to know:
|
117
|
+
|
118
|
+
(1) ... if a topic branch has ever been merged to "next". Young
|
119
|
+
topic branches can have stupid mistakes you would rather
|
120
|
+
clean up before publishing, and things that have not been
|
121
|
+
merged into other branches can be easily rebased without
|
122
|
+
affecting other people. But once it is published, you would
|
123
|
+
not want to rewind it.
|
124
|
+
|
125
|
+
(2) ... if a topic branch has been fully merged to "master".
|
126
|
+
Then you can delete it. More importantly, you should not
|
127
|
+
build on top of it -- other people may already want to
|
128
|
+
change things related to the topic as patches against your
|
129
|
+
"master", so if you need further changes, it is better to
|
130
|
+
fork the topic (perhaps with the same name) afresh from the
|
131
|
+
tip of "master".
|
132
|
+
|
133
|
+
Let's look at this example:
|
134
|
+
|
135
|
+
o---o---o---o---o---o---o---o---o---o "next"
|
136
|
+
/ / / /
|
137
|
+
/ a---a---b A / /
|
138
|
+
/ / / /
|
139
|
+
/ / c---c---c---c B /
|
140
|
+
/ / / \ /
|
141
|
+
/ / / b---b C \ /
|
142
|
+
/ / / / \ /
|
143
|
+
---o---o---o---o---o---o---o---o---o---o---o "master"
|
144
|
+
|
145
|
+
|
146
|
+
A, B and C are topic branches.
|
147
|
+
|
148
|
+
* A has one fix since it was merged up to "next".
|
149
|
+
|
150
|
+
* B has finished. It has been fully merged up to "master" and "next",
|
151
|
+
and is ready to be deleted.
|
152
|
+
|
153
|
+
* C has not merged to "next" at all.
|
154
|
+
|
155
|
+
We would want to allow C to be rebased, refuse A, and encourage
|
156
|
+
B to be deleted.
|
157
|
+
|
158
|
+
To compute (1):
|
159
|
+
|
160
|
+
git rev-list ^master ^topic next
|
161
|
+
git rev-list ^master next
|
162
|
+
|
163
|
+
if these match, topic has not merged in next at all.
|
164
|
+
|
165
|
+
To compute (2):
|
166
|
+
|
167
|
+
git rev-list master..topic
|
168
|
+
|
169
|
+
if this is empty, it is fully merged to "master".
|
@@ -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,4 @@
|
|
1
|
+
0000000000000000000000000000000000000000 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225561 -0800 commit (initial): first commit
|
2
|
+
b60afe294eb3c200d646995c9e0234470157c1b0 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225573 -0800 checkout: moving from master to master
|
3
|
+
b60afe294eb3c200d646995c9e0234470157c1b0 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225580 -0800 checkout: moving from master to delete_me
|
4
|
+
b60afe294eb3c200d646995c9e0234470157c1b0 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225584 -0800 checkout: moving from delete_me to master
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225568 -0800 branch: Created from master
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 b60afe294eb3c200d646995c9e0234470157c1b0 Daniel Smilansky <dsmilansky@gmail.com> 1386225561 -0800 commit (initial): first commit
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
b60afe294eb3c200d646995c9e0234470157c1b0
|
@@ -0,0 +1 @@
|
|
1
|
+
b60afe294eb3c200d646995c9e0234470157c1b0
|
File without changes
|
data/levels/fetch.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
difficulty 2
|
2
|
+
description "Looks like a new branch was pushed into our remote repository. Get the changes without merging them with the local repository "
|
3
|
+
|
4
|
+
setup do
|
5
|
+
# remember the working directory so we can come back to it later
|
6
|
+
cwd = Dir.pwd
|
7
|
+
# initialize another git repo to be used as a "remote"
|
8
|
+
tmpdir = Dir.mktmpdir
|
9
|
+
|
10
|
+
# local repo
|
11
|
+
repo.init
|
12
|
+
|
13
|
+
#adds a file to origin/master
|
14
|
+
FileUtils.touch "master_file"
|
15
|
+
repo.add "master_file"
|
16
|
+
repo.commit_all 'Commits master_file'
|
17
|
+
|
18
|
+
# remote repo
|
19
|
+
Dir.chdir tmpdir
|
20
|
+
repo.init
|
21
|
+
|
22
|
+
#adds a file to origin/master
|
23
|
+
FileUtils.touch "master_file"
|
24
|
+
repo.add "master_file"
|
25
|
+
repo.commit_all 'Commits master_file'
|
26
|
+
|
27
|
+
#adds remote repo
|
28
|
+
Dir.chdir cwd
|
29
|
+
`git remote add origin #{tmpdir}/.git`
|
30
|
+
`git fetch origin --quiet`
|
31
|
+
`git branch -u origin/master master`
|
32
|
+
|
33
|
+
Dir.chdir tmpdir
|
34
|
+
# create a new branch in the remote repo
|
35
|
+
`git checkout -b new_branch --quiet`
|
36
|
+
|
37
|
+
# adds a file into the new branch. Should not be pulled into the local
|
38
|
+
FileUtils.touch "file1"
|
39
|
+
repo.add "file1"
|
40
|
+
repo.commit_all 'Commits file 1'
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
solution do
|
45
|
+
repo.init
|
46
|
+
result = true
|
47
|
+
|
48
|
+
|
49
|
+
# counts the number of local branches. Should equal 1
|
50
|
+
local_branches = repo.branches.size
|
51
|
+
|
52
|
+
# after a git fetch command, each branch will be stored in in the .git/FETCH_HEAD file. Each branch is on its own line
|
53
|
+
# This command will count the number of lines, which will give the number of branches
|
54
|
+
if File.file?('.git/FETCH_HEAD') #checks for file existance
|
55
|
+
num_remote = `wc -l < .git/FETCH_HEAD`
|
56
|
+
else
|
57
|
+
num_remote = '0'
|
58
|
+
end
|
59
|
+
|
60
|
+
# there should be 1 local branch and 2 remote branches for a success condition
|
61
|
+
if local_branches == 1 and num_remote.to_i == 2
|
62
|
+
result = true
|
63
|
+
else
|
64
|
+
result = false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
hint do
|
69
|
+
puts "Look up the 'git fetch' command"
|
70
|
+
end
|
data/levels/include.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
difficulty 2
|
2
|
+
description "Notice a few files with the '.a' extension. We want git to ignore all but the 'lib.a' file."
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
FileUtils.touch("first.a")
|
7
|
+
FileUtils.touch("second.a")
|
8
|
+
FileUtils.touch("lib.a")
|
9
|
+
file = File.open(".git/config", "w") do |file|
|
10
|
+
file.puts "[core]\nexcludesfile="
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
solution do
|
15
|
+
entries = File.readlines('.gitignore').map(&:chomp)
|
16
|
+
entries.include? '*.a' and entries.include? '!lib.a'
|
17
|
+
end
|
18
|
+
|
19
|
+
hint do
|
20
|
+
puts "Using `git gitignore --help`, read about the optional prefix to negate a pattern."
|
21
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "There are some files in this repository, how many of the files will be committed?"
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
|
7
|
+
#Modified files
|
8
|
+
%w{rubyfile4.rb rubyfile5.rb}.each do |file|
|
9
|
+
FileUtils.touch(file)
|
10
|
+
repo.add(file)
|
11
|
+
end
|
12
|
+
repo.commit_all "Commit"
|
13
|
+
|
14
|
+
#Staged file
|
15
|
+
File.open("rubyfile4.rb", 'w') { |f| f << "#Changes" }
|
16
|
+
repo.add("rubyfile4.rb")
|
17
|
+
|
18
|
+
#Not staged file
|
19
|
+
File.open("rubyfile5.rb", 'w') { |f| f << "#Changes" }
|
20
|
+
|
21
|
+
#Changes to be committed
|
22
|
+
%w{rubyfile1.rb}.each do |file|
|
23
|
+
FileUtils.touch(file)
|
24
|
+
repo.add(file)
|
25
|
+
end
|
26
|
+
|
27
|
+
#Untrached files
|
28
|
+
%w{rubyfile6.rb rubyfile7.rb}.each do |file|
|
29
|
+
FileUtils.touch(file)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
solution do
|
34
|
+
numberOfFilesThereWillBeCommit = request("How many changes are going to be committed?")
|
35
|
+
|
36
|
+
isInteger = !!(numberOfFilesThereWillBeCommit =~ /^[-+]?[0-9]+$/)
|
37
|
+
|
38
|
+
if !isInteger
|
39
|
+
return false
|
40
|
+
end
|
41
|
+
|
42
|
+
if numberOfFilesThereWillBeCommit.to_i == 2
|
43
|
+
return true
|
44
|
+
end
|
45
|
+
|
46
|
+
return false
|
47
|
+
end
|
48
|
+
|
49
|
+
hint do
|
50
|
+
puts "You are looking for a command to identify the status of the repository."
|
51
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
difficulty 2
|
2
|
+
description "You've made some changes to a local branch and want to share it, but aren't yet ready to merge it with the 'master' branch. Push only 'test_branch' to the remote repository"
|
3
|
+
|
4
|
+
setup do
|
5
|
+
|
6
|
+
# remember the working directory so we can come back to it later
|
7
|
+
cwd = Dir.pwd
|
8
|
+
# initialize another git repo to be used as a "remote"
|
9
|
+
tmpdir = Dir.mktmpdir
|
10
|
+
|
11
|
+
# local repo
|
12
|
+
repo.init
|
13
|
+
|
14
|
+
FileUtils.touch "file1"
|
15
|
+
repo.add "file1"
|
16
|
+
repo.commit_all "committed changes on master"
|
17
|
+
|
18
|
+
# copy the repo to remote
|
19
|
+
FileUtils.cp_r ".", tmpdir
|
20
|
+
|
21
|
+
# add another file. If successful this file won't be pushed to the remote repository
|
22
|
+
FileUtils.touch "file2"
|
23
|
+
repo.add "file2"
|
24
|
+
repo.commit_all "If this commit gets pushed to repo, then you have lost the level :( "
|
25
|
+
|
26
|
+
#This branch should not be pushed to to the remote repository
|
27
|
+
`git checkout -b other_branch --quiet`
|
28
|
+
# add another file
|
29
|
+
FileUtils.touch "file3"
|
30
|
+
repo.add "file3"
|
31
|
+
repo.commit_all "If this commit gets pushed to repo, then you have lost the level :( "
|
32
|
+
|
33
|
+
`git checkout -b test_branch --quiet`
|
34
|
+
|
35
|
+
#This file should get pushed if the level is successful
|
36
|
+
FileUtils.touch "file4"
|
37
|
+
repo.add "file4"
|
38
|
+
repo.commit_all "committed change on test_branch"
|
39
|
+
|
40
|
+
# remote repo
|
41
|
+
Dir.chdir tmpdir
|
42
|
+
|
43
|
+
repo.init
|
44
|
+
|
45
|
+
# make a 'non-bare' repo accept pushes
|
46
|
+
`git config receive.denyCurrentBranch ignore`
|
47
|
+
|
48
|
+
# change back to original repo to set up a remote
|
49
|
+
Dir.chdir cwd
|
50
|
+
`git remote add origin #{tmpdir}/.git`
|
51
|
+
`git fetch --quiet origin`
|
52
|
+
`git branch -u origin/master master`
|
53
|
+
|
54
|
+
`git checkout master --quiet` #return to master branch
|
55
|
+
end
|
56
|
+
|
57
|
+
solution do
|
58
|
+
repo.init
|
59
|
+
result = false
|
60
|
+
|
61
|
+
#each branch consits of one line, `wc -l counts the number of lines in order to get the number of remote branches`
|
62
|
+
#At the moment Grit doesn't support remote branch references but is on the ToDo list. This should be revisited when Grit implements the change
|
63
|
+
num_remote_branches = `git branch -r | wc -l`.to_i
|
64
|
+
|
65
|
+
# counts the number of commits in the remote master branch'
|
66
|
+
remote_master_commits = repo.commits('origin/master').count
|
67
|
+
remote_test_branch_commits = repo.commits('origin/test_branch').count #if returns 0 indicates that the remote test_branch doesn't exist
|
68
|
+
|
69
|
+
#Level will be successful if the remote master branch remains at 1 commit, the remote test_branch exits and the number of remote branches
|
70
|
+
if remote_master_commits == 1 and remote_test_branch_commits > 0 and num_remote_branches == 2
|
71
|
+
result = true
|
72
|
+
|
73
|
+
#User pushed up too many branches, level failed
|
74
|
+
elsif num_remote_branches > 2
|
75
|
+
puts "*** It looks like you pushed up too many branches. You need to make sure only 'test_branch' gets pushed. Please try again! ***"
|
76
|
+
|
77
|
+
#User pushed up the master banch, level failed
|
78
|
+
elsif remote_master_commits > 1
|
79
|
+
puts "*** It looks like you pushed up new master branch changes. You need to make sure only 'test_branch' gets pushed. Please try again! ***"
|
80
|
+
end
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
hint do
|
86
|
+
puts "Investigate the options in `git push` using `git push --help`"
|
87
|
+
end
|
data/levels/push_tags.rb
CHANGED
@@ -46,7 +46,7 @@ solution do
|
|
46
46
|
|
47
47
|
# a bit hacky solution to get tags from remote
|
48
48
|
remote_tags=
|
49
|
-
repo.git.raw_git_call("git ls-remote --tags
|
49
|
+
repo.git.raw_git_call("git ls-remote --tags .", repo.git.git_file_index).
|
50
50
|
first.
|
51
51
|
split("\n")
|
52
52
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
difficulty 3
|
2
|
+
|
3
|
+
description "You added some files to your repository, but now realize that your project needs to be restructured. Make a new folder named `src`, and move all of the .html files into this folder."
|
4
|
+
|
5
|
+
setup do
|
6
|
+
repo.init
|
7
|
+
|
8
|
+
FileUtils.touch("about.html")
|
9
|
+
FileUtils.touch("contact.html")
|
10
|
+
FileUtils.touch("index.html")
|
11
|
+
|
12
|
+
repo.add("about.html")
|
13
|
+
repo.add("contact.html")
|
14
|
+
repo.add("index.html")
|
15
|
+
|
16
|
+
repo.commit_all("adding web content.")
|
17
|
+
end
|
18
|
+
|
19
|
+
solution do
|
20
|
+
index =
|
21
|
+
repo.status["index.html"].type == "D" &&
|
22
|
+
repo.status["index.html"].stage.nil? &&
|
23
|
+
repo.status["src/index.html"].type == "A"
|
24
|
+
|
25
|
+
about =
|
26
|
+
repo.status["about.html"].type == "D" &&
|
27
|
+
repo.status["about.html"].stage.nil? &&
|
28
|
+
repo.status["src/about.html"].type == "A"
|
29
|
+
|
30
|
+
contact =
|
31
|
+
repo.status["contact.html"].type == "D" &&
|
32
|
+
repo.status["contact.html"].stage.nil? &&
|
33
|
+
repo.status["src/contact.html"].type == "A"
|
34
|
+
|
35
|
+
index && about && contact
|
36
|
+
end
|
37
|
+
|
38
|
+
hint do
|
39
|
+
puts "You'll have to use mkdir, and `git mv`."
|
40
|
+
end
|
data/lib/githug/level.rb
CHANGED
@@ -3,14 +3,15 @@ module Githug
|
|
3
3
|
include UI
|
4
4
|
|
5
5
|
LEVELS = [nil, "init", "config", "add", "commit", "clone",
|
6
|
-
"clone_to_folder", "ignore", "
|
7
|
-
"
|
8
|
-
"
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
6
|
+
"clone_to_folder", "ignore", "include", "status",
|
7
|
+
"number_of_files_committed", "rm", "rm_cached", "stash", "rename",
|
8
|
+
"restructure", "log", "tag", "push_tags", "commit_amend",
|
9
|
+
"commit_in_future", "reset", "reset_soft", "checkout_file", "remote",
|
10
|
+
"remote_url", "pull", "remote_add", "push", "diff", "blame", "branch",
|
11
|
+
"checkout", "checkout_tag", "checkout_tag_over_branch", "branch_at",
|
12
|
+
"delete_branch", "push_branch", "merge", "fetch", "repack", "cherry-pick",
|
13
|
+
"grep", "rename_commit", "squash", "merge_squash", "reorder", "bisect",
|
14
|
+
"stage_lines", "find_old_branch", "revert", "restore", "conflict", "contribute"]
|
14
15
|
|
15
16
|
attr_accessor :level_no, :level_path, :level_name
|
16
17
|
|
data/lib/githug/ui.rb
CHANGED
data/lib/githug/version.rb
CHANGED
data/spec/githug_spec.rb
CHANGED
@@ -67,11 +67,20 @@ describe "The Game" do
|
|
67
67
|
`echo "*.swp" >> .gitignore`
|
68
68
|
`githug`.should be_solved
|
69
69
|
end
|
70
|
+
|
71
|
+
it "should complete the include level" do
|
72
|
+
`echo "*.a\n!lib.a" >> .gitignore`
|
73
|
+
`githug`.should be_solved
|
74
|
+
end
|
70
75
|
|
71
76
|
it "should complete the status level" do
|
72
77
|
`git ls-files --other --exclude-standard | githug`.should be_solved
|
73
78
|
end
|
74
79
|
|
80
|
+
it "should complete the number of files committed level" do
|
81
|
+
`git diff --name-only --cached | wc -l | githug`.should be_solved
|
82
|
+
end
|
83
|
+
|
75
84
|
it "should complete the rm level" do
|
76
85
|
file_name = `git status | grep deleted | cut -d " " -f 5`
|
77
86
|
`git rm #{file_name}`
|
@@ -94,6 +103,12 @@ describe "The Game" do
|
|
94
103
|
`githug`.should be_solved
|
95
104
|
end
|
96
105
|
|
106
|
+
it "should complete the restructure level" do
|
107
|
+
`mkdir src`
|
108
|
+
`git mv *.html src`
|
109
|
+
`githug`.should be_solved
|
110
|
+
end
|
111
|
+
|
97
112
|
it "should complete the log level" do
|
98
113
|
`git log --pretty=short | grep commit | cut -c 8-14 | githug`.should be_solved
|
99
114
|
end
|
@@ -114,6 +129,14 @@ describe "The Game" do
|
|
114
129
|
`githug`.should be_solved
|
115
130
|
end
|
116
131
|
|
132
|
+
it "should complete the commit_in_future level" do
|
133
|
+
authored_date = Time.now + 14
|
134
|
+
authored_date = authored_date.rfc2822
|
135
|
+
|
136
|
+
`git commit -m "Test of future date" --date="#{authored_date}"`
|
137
|
+
`githug`.should be_solved
|
138
|
+
end
|
139
|
+
|
117
140
|
it "should complete the reset level" do
|
118
141
|
`git reset HEAD to_commit_second.rb`
|
119
142
|
`githug`.should be_solved
|
@@ -187,11 +210,26 @@ describe "The Game" do
|
|
187
210
|
`githug`.should be_solved
|
188
211
|
end
|
189
212
|
|
213
|
+
it "should complete the delete_branch level" do
|
214
|
+
`git branch -d delete_me`
|
215
|
+
`githug`.should be_solved
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should complete the push_branch level" do
|
219
|
+
`git push origin test_branch`
|
220
|
+
`githug`.should be_solved
|
221
|
+
end
|
222
|
+
|
190
223
|
it "should commit the merge level" do
|
191
224
|
`git merge feature`
|
192
225
|
`githug`.should be_solved
|
193
226
|
end
|
194
227
|
|
228
|
+
it "should complete the fetch level" do
|
229
|
+
`git fetch`
|
230
|
+
`githug`.should be_solved
|
231
|
+
end
|
232
|
+
|
195
233
|
it "should complete the repack level" do
|
196
234
|
`git repack -d`
|
197
235
|
`githug`.should be_solved
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Rennie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- levels/clone_to_folder.rb
|
207
207
|
- levels/commit.rb
|
208
208
|
- levels/commit_amend.rb
|
209
|
+
- levels/commit_in_future.rb
|
209
210
|
- levels/config.rb
|
210
211
|
- levels/conflict.rb
|
211
212
|
- levels/conflict/.githug/COMMIT_EDITMSG
|
@@ -249,6 +250,31 @@ files:
|
|
249
250
|
- levels/conflict/.githug/refs/heads/mybranch
|
250
251
|
- levels/conflict/poem.txt
|
251
252
|
- levels/contribute.rb
|
253
|
+
- levels/delete_branch.rb
|
254
|
+
- levels/delete_branch/.githug/COMMIT_EDITMSG
|
255
|
+
- levels/delete_branch/.githug/HEAD
|
256
|
+
- levels/delete_branch/.githug/config
|
257
|
+
- levels/delete_branch/.githug/description
|
258
|
+
- levels/delete_branch/.githug/hooks/applypatch-msg.sample
|
259
|
+
- levels/delete_branch/.githug/hooks/commit-msg.sample
|
260
|
+
- levels/delete_branch/.githug/hooks/post-update.sample
|
261
|
+
- levels/delete_branch/.githug/hooks/pre-applypatch.sample
|
262
|
+
- levels/delete_branch/.githug/hooks/pre-commit.sample
|
263
|
+
- levels/delete_branch/.githug/hooks/pre-push.sample
|
264
|
+
- levels/delete_branch/.githug/hooks/pre-rebase.sample
|
265
|
+
- levels/delete_branch/.githug/hooks/prepare-commit-msg.sample
|
266
|
+
- levels/delete_branch/.githug/hooks/update.sample
|
267
|
+
- levels/delete_branch/.githug/index
|
268
|
+
- levels/delete_branch/.githug/info/exclude
|
269
|
+
- levels/delete_branch/.githug/logs/HEAD
|
270
|
+
- levels/delete_branch/.githug/logs/refs/heads/delete_me
|
271
|
+
- levels/delete_branch/.githug/logs/refs/heads/master
|
272
|
+
- levels/delete_branch/.githug/objects/b6/0afe294eb3c200d646995c9e0234470157c1b0
|
273
|
+
- levels/delete_branch/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
274
|
+
- levels/delete_branch/.githug/objects/e8/0ad49ace82167de62e498622d70377d913c79e
|
275
|
+
- levels/delete_branch/.githug/refs/heads/delete_me
|
276
|
+
- levels/delete_branch/.githug/refs/heads/master
|
277
|
+
- levels/delete_branch/readme
|
252
278
|
- levels/diff.rb
|
253
279
|
- levels/diff/.githug/COMMIT_EDITMSG
|
254
280
|
- levels/diff/.githug/HEAD
|
@@ -273,6 +299,7 @@ files:
|
|
273
299
|
- levels/diff/.githug/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6
|
274
300
|
- levels/diff/.githug/refs/heads/master
|
275
301
|
- levels/diff/app.rb
|
302
|
+
- levels/fetch.rb
|
276
303
|
- levels/find_old_branch.rb
|
277
304
|
- levels/find_old_branch/.githug/COMMIT_EDITMSG
|
278
305
|
- levels/find_old_branch/.githug/HEAD
|
@@ -339,6 +366,7 @@ files:
|
|
339
366
|
- levels/grep/app.rb
|
340
367
|
- levels/grep/config.rb
|
341
368
|
- levels/ignore.rb
|
369
|
+
- levels/include.rb
|
342
370
|
- levels/init.rb
|
343
371
|
- levels/log.rb
|
344
372
|
- levels/merge.rb
|
@@ -370,8 +398,10 @@ files:
|
|
370
398
|
- levels/merge/.githug/refs/heads/master
|
371
399
|
- levels/merge/file1
|
372
400
|
- levels/merge_squash.rb
|
401
|
+
- levels/number_of_files_committed.rb
|
373
402
|
- levels/pull.rb
|
374
403
|
- levels/push.rb
|
404
|
+
- levels/push_branch.rb
|
375
405
|
- levels/push_tags.rb
|
376
406
|
- levels/remote.rb
|
377
407
|
- levels/remote_add.rb
|
@@ -383,6 +413,7 @@ files:
|
|
383
413
|
- levels/reset.rb
|
384
414
|
- levels/reset_soft.rb
|
385
415
|
- levels/restore.rb
|
416
|
+
- levels/restructure.rb
|
386
417
|
- levels/revert.rb
|
387
418
|
- levels/rm.rb
|
388
419
|
- levels/rm_cached.rb
|