Skip to content

Commit

Permalink
Merge remote-tracking branch 'guywithnonose/bisect'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Rennie committed Apr 28, 2012
2 parents 8a883ec + 8839689 commit 41eb42f
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 1 deletion.
14 changes: 14 additions & 0 deletions levels/bisect.rb
@@ -0,0 +1,14 @@
difficulty 3
description "A bug was introduced somewhere along the way. You know that running 'ruby prog.rb 5' should output 15. You can also run 'make test'. What are the first 7 chars of the hash of the commit that introduced the bug."

setup do
init_from_level
end

solution do
"94e162b" == request("What are the first 7 characters of the hash of the commit that introduced the bug?")
end

hint do
puts ["The fastest way to find the bug is with bisect.", "Start bisect with a good and bad commit, then run git bisect run make test."]
end
1 change: 1 addition & 0 deletions levels/bisect/.githug/HEAD
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions levels/bisect/.githug/ORIG_HEAD
@@ -0,0 +1 @@
bfb16eec1081387b586dc8009ef422cfff60b622
5 changes: 5 additions & 0 deletions levels/bisect/.githug/config
@@ -0,0 +1,5 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
1 change: 1 addition & 0 deletions levels/bisect/.githug/description
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Binary file added levels/bisect/.githug/index
Binary file not shown.
6 changes: 6 additions & 0 deletions levels/bisect/.githug/info/exclude
@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
5 changes: 5 additions & 0 deletions levels/bisect/.githug/info/refs
@@ -0,0 +1,5 @@
94e162b505bc2290fb67764357a625192f8a4e8a refs/bisect/bad
bfb16eec1081387b586dc8009ef422cfff60b622 refs/bisect/good-bfb16eec1081387b586dc8009ef422cfff60b622
c0a1cdff8dd63948a5fc41f5871681c5b133c053 refs/bisect/good-c0a1cdff8dd63948a5fc41f5871681c5b133c053
f608824888b83bbedc1f658be7496ffea467a8fb refs/bisect/good-f608824888b83bbedc1f658be7496ffea467a8fb
f351ca63a759f56bb26924fd566294eb23455c71 refs/heads/master
25 changes: 25 additions & 0 deletions levels/bisect/.githug/logs/HEAD
@@ -0,0 +1,25 @@
0000000000000000000000000000000000000000 b066349076e2b71e3b71cfeb1ba88af99cc036f6 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit (initial): First commit
b066349076e2b71e3b71cfeb1ba88af99cc036f6 15c915b17ee502c80df64aff04da024c17ac9da0 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit: Bad commit
15c915b17ee502c80df64aff04da024c17ac9da0 d9882afd25595d7d6dc8ead68c68e4f00c94c9b2 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit: Second commit
d9882afd25595d7d6dc8ead68c68e4f00c94c9b2 b066349076e2b71e3b71cfeb1ba88af99cc036f6 Robert Bittle <guywithnose@gmail.com> 1335144309 -0400 checkout: moving from master to b066349076e2b71e3b71cfeb1ba88af99cc036f6
b066349076e2b71e3b71cfeb1ba88af99cc036f6 bed2d266fa44b56968a17f1e2d409b306032bd6d Robert Bittle <guywithnose@gmail.com> 1335144309 -0400 rebase -i (pick): Second commit
bed2d266fa44b56968a17f1e2d409b306032bd6d b066349076e2b71e3b71cfeb1ba88af99cc036f6 Robert Bittle <guywithnose@gmail.com> 1335175555 -0400 HEAD~1: updating HEAD
b066349076e2b71e3b71cfeb1ba88af99cc036f6 f608824888b83bbedc1f658be7496ffea467a8fb Robert Bittle <guywithnose@gmail.com> 1335177947 -0400 commit (amend): First commit
f608824888b83bbedc1f658be7496ffea467a8fb d406b1b8bc269c9aef9127299e83947220e7a9b0 Robert Bittle <guywithnose@gmail.com> 1335178003 -0400 commit: Another Commit
d406b1b8bc269c9aef9127299e83947220e7a9b0 0b194f30d6867522d1666590087e6c0b5e20dc93 Robert Bittle <guywithnose@gmail.com> 1335178095 -0400 commit: Another Commit
0b194f30d6867522d1666590087e6c0b5e20dc93 98d617d3bdf0b6c59d6177233acb4b9fd54b7aac Robert Bittle <guywithnose@gmail.com> 1335178214 -0400 commit: Another Commit
98d617d3bdf0b6c59d6177233acb4b9fd54b7aac 89d27c5f4680cd21028947be75c33a68511decb9 Robert Bittle <guywithnose@gmail.com> 1335178242 -0400 commit: Another Commit
89d27c5f4680cd21028947be75c33a68511decb9 e8dd08d5aabb62b56c80320672cd8d42e2b8954d Robert Bittle <guywithnose@gmail.com> 1335178263 -0400 commit: Another Commit
e8dd08d5aabb62b56c80320672cd8d42e2b8954d c0a1cdff8dd63948a5fc41f5871681c5b133c053 Robert Bittle <guywithnose@gmail.com> 1335178286 -0400 commit: Another Commit
c0a1cdff8dd63948a5fc41f5871681c5b133c053 bfb16eec1081387b586dc8009ef422cfff60b622 Robert Bittle <guywithnose@gmail.com> 1335178306 -0400 commit: Another Commit
bfb16eec1081387b586dc8009ef422cfff60b622 94e162b505bc2290fb67764357a625192f8a4e8a Robert Bittle <guywithnose@gmail.com> 1335178330 -0400 commit: Another Commit
94e162b505bc2290fb67764357a625192f8a4e8a 4145057e11ab90109c95882b1f40d560da408bfa Robert Bittle <guywithnose@gmail.com> 1335178341 -0400 commit: Another Commit
4145057e11ab90109c95882b1f40d560da408bfa c1b80f5ed4995cda8e19027f0776351af6b76703 Robert Bittle <guywithnose@gmail.com> 1335178357 -0400 commit: Another Commit
c1b80f5ed4995cda8e19027f0776351af6b76703 36da01fb0571360b0e1170f0cb46e74f72927cda Robert Bittle <guywithnose@gmail.com> 1335178376 -0400 commit: Another Commit
36da01fb0571360b0e1170f0cb46e74f72927cda 7f8406e742c5281ec2c9bc3c6cc69dc6ba5311fd Robert Bittle <guywithnose@gmail.com> 1335178390 -0400 commit: Another Commit
7f8406e742c5281ec2c9bc3c6cc69dc6ba5311fd f351ca63a759f56bb26924fd566294eb23455c71 Robert Bittle <guywithnose@gmail.com> 1335178407 -0400 commit: Another Commit
f351ca63a759f56bb26924fd566294eb23455c71 c0a1cdff8dd63948a5fc41f5871681c5b133c053 Robert Bittle <guywithnose@gmail.com> 1335178499 -0400 checkout: moving from master to c0a1cdff8dd63948a5fc41f5871681c5b133c053
c0a1cdff8dd63948a5fc41f5871681c5b133c053 4145057e11ab90109c95882b1f40d560da408bfa Robert Bittle <guywithnose@gmail.com> 1335178506 -0400 checkout: moving from c0a1cdff8dd63948a5fc41f5871681c5b133c053 to 4145057e11ab90109c95882b1f40d560da408bfa
4145057e11ab90109c95882b1f40d560da408bfa 94e162b505bc2290fb67764357a625192f8a4e8a Robert Bittle <guywithnose@gmail.com> 1335178506 -0400 checkout: moving from 4145057e11ab90109c95882b1f40d560da408bfa to 94e162b505bc2290fb67764357a625192f8a4e8a
94e162b505bc2290fb67764357a625192f8a4e8a bfb16eec1081387b586dc8009ef422cfff60b622 Robert Bittle <guywithnose@gmail.com> 1335178506 -0400 checkout: moving from 94e162b505bc2290fb67764357a625192f8a4e8a to bfb16eec1081387b586dc8009ef422cfff60b622
bfb16eec1081387b586dc8009ef422cfff60b622 f351ca63a759f56bb26924fd566294eb23455c71 Robert Bittle <guywithnose@gmail.com> 1335182458 -0400 reset: moving to master
19 changes: 19 additions & 0 deletions levels/bisect/.githug/logs/refs/heads/master
@@ -0,0 +1,19 @@
0000000000000000000000000000000000000000 b066349076e2b71e3b71cfeb1ba88af99cc036f6 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit (initial): First commit
b066349076e2b71e3b71cfeb1ba88af99cc036f6 15c915b17ee502c80df64aff04da024c17ac9da0 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit: Bad commit
15c915b17ee502c80df64aff04da024c17ac9da0 d9882afd25595d7d6dc8ead68c68e4f00c94c9b2 Robert Bittle <guywithnose@gmail.com> 1335144302 -0400 commit: Second commit
d9882afd25595d7d6dc8ead68c68e4f00c94c9b2 bed2d266fa44b56968a17f1e2d409b306032bd6d Robert Bittle <guywithnose@gmail.com> 1335144309 -0400 rebase -i (finish): refs/heads/master onto b066349
bed2d266fa44b56968a17f1e2d409b306032bd6d b066349076e2b71e3b71cfeb1ba88af99cc036f6 Robert Bittle <guywithnose@gmail.com> 1335175555 -0400 HEAD~1: updating HEAD
b066349076e2b71e3b71cfeb1ba88af99cc036f6 f608824888b83bbedc1f658be7496ffea467a8fb Robert Bittle <guywithnose@gmail.com> 1335177947 -0400 commit (amend): First commit
f608824888b83bbedc1f658be7496ffea467a8fb d406b1b8bc269c9aef9127299e83947220e7a9b0 Robert Bittle <guywithnose@gmail.com> 1335178003 -0400 commit: Another Commit
d406b1b8bc269c9aef9127299e83947220e7a9b0 0b194f30d6867522d1666590087e6c0b5e20dc93 Robert Bittle <guywithnose@gmail.com> 1335178095 -0400 commit: Another Commit
0b194f30d6867522d1666590087e6c0b5e20dc93 98d617d3bdf0b6c59d6177233acb4b9fd54b7aac Robert Bittle <guywithnose@gmail.com> 1335178214 -0400 commit: Another Commit
98d617d3bdf0b6c59d6177233acb4b9fd54b7aac 89d27c5f4680cd21028947be75c33a68511decb9 Robert Bittle <guywithnose@gmail.com> 1335178242 -0400 commit: Another Commit
89d27c5f4680cd21028947be75c33a68511decb9 e8dd08d5aabb62b56c80320672cd8d42e2b8954d Robert Bittle <guywithnose@gmail.com> 1335178263 -0400 commit: Another Commit
e8dd08d5aabb62b56c80320672cd8d42e2b8954d c0a1cdff8dd63948a5fc41f5871681c5b133c053 Robert Bittle <guywithnose@gmail.com> 1335178286 -0400 commit: Another Commit
c0a1cdff8dd63948a5fc41f5871681c5b133c053 bfb16eec1081387b586dc8009ef422cfff60b622 Robert Bittle <guywithnose@gmail.com> 1335178306 -0400 commit: Another Commit
bfb16eec1081387b586dc8009ef422cfff60b622 94e162b505bc2290fb67764357a625192f8a4e8a Robert Bittle <guywithnose@gmail.com> 1335178330 -0400 commit: Another Commit
94e162b505bc2290fb67764357a625192f8a4e8a 4145057e11ab90109c95882b1f40d560da408bfa Robert Bittle <guywithnose@gmail.com> 1335178341 -0400 commit: Another Commit
4145057e11ab90109c95882b1f40d560da408bfa c1b80f5ed4995cda8e19027f0776351af6b76703 Robert Bittle <guywithnose@gmail.com> 1335178357 -0400 commit: Another Commit
c1b80f5ed4995cda8e19027f0776351af6b76703 36da01fb0571360b0e1170f0cb46e74f72927cda Robert Bittle <guywithnose@gmail.com> 1335178376 -0400 commit: Another Commit
36da01fb0571360b0e1170f0cb46e74f72927cda 7f8406e742c5281ec2c9bc3c6cc69dc6ba5311fd Robert Bittle <guywithnose@gmail.com> 1335178390 -0400 commit: Another Commit
7f8406e742c5281ec2c9bc3c6cc69dc6ba5311fd f351ca63a759f56bb26924fd566294eb23455c71 Robert Bittle <guywithnose@gmail.com> 1335178407 -0400 commit: Another Commit
2 changes: 2 additions & 0 deletions levels/bisect/.githug/objects/info/packs
@@ -0,0 +1,2 @@
P pack-34f18db272b06cca4ff6cbbdbc96d496f6b28995.pack

Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions levels/bisect/.githug/packed-refs
@@ -0,0 +1,6 @@
# pack-refs with: peeled
94e162b505bc2290fb67764357a625192f8a4e8a refs/bisect/bad
bfb16eec1081387b586dc8009ef422cfff60b622 refs/bisect/good-bfb16eec1081387b586dc8009ef422cfff60b622
c0a1cdff8dd63948a5fc41f5871681c5b133c053 refs/bisect/good-c0a1cdff8dd63948a5fc41f5871681c5b133c053
f608824888b83bbedc1f658be7496ffea467a8fb refs/bisect/good-f608824888b83bbedc1f658be7496ffea467a8fb
f351ca63a759f56bb26924fd566294eb23455c71 refs/heads/master
2 changes: 2 additions & 0 deletions levels/bisect/makefile
@@ -0,0 +1,2 @@
test:
ruby prog.rb 5 | ruby test.rb
3 changes: 3 additions & 0 deletions levels/bisect/prog.rb
@@ -0,0 +1,3 @@
#!/usr/bin/env ruby

puts Integer((Integer(ARGV[0])-3)*9)-1
4 changes: 4 additions & 0 deletions levels/bisect/test.rb
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby

line = gets
exit 1 if line != "15\n"
2 changes: 1 addition & 1 deletion lib/githug/level.rb
Expand Up @@ -8,7 +8,7 @@ class Level
"checkout_file", "remote", "remote_url", "pull", "remote_add",
"diff", "blame", "branch", "checkout", "branch_at", "merge",
"cherry-pick", "rename_commit", "squash", "merge_squash", "reorder",
"stage_lines", "find_old_branch", "revert", "contribute"]
"bisect", "stage_lines", "find_old_branch", "revert", "contribute"]

attr_accessor :level_no, :level_path

Expand Down

0 comments on commit 41eb42f

Please sign in to comment.