-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathcheckout_tag.rb
41 lines (32 loc) · 988 Bytes
/
checkout_tag.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
difficulty 2
description "You need to fix a bug in the version 1.2 of your app. Checkout the tag `v1.2`."
setup do
repo.init
FileUtils.touch("app.rb")
repo.add("app.rb")
repo.commit_all("Initial commit")
`echo "Some code" >> app.rb`
repo.add("app.rb")
repo.commit_all("Some changes")
repo.git.tag( { 'f' => true }, "v1.0" )
`echo "Buggy code" >> app.rb`
repo.add("app.rb")
repo.commit_all("Some more changes")
repo.git.tag( { 'f' => true }, "v1.2" )
`echo "More code" >> app.rb`
repo.add("app.rb")
repo.commit_all("Yet more changes")
`echo "Some more code" >> app.rb`
repo.add("app.rb")
repo.commit_all("Changes galore")
repo.git.tag( { 'f' => true }, "v1.5" )
system "git branch -m master"
end
solution do
return false unless repo.commits.length == 5
return false unless `git show HEAD --format=%s` =~ /Some more changes/
true
end
hint do
puts "There's no big difference between checking out a branch and checking out a tag."
end