git-blame-game 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +5 -0
- data/README.md +7 -5
- data/Rakefile +10 -0
- data/TODO +5 -0
- data/bin/git-ann-game +31 -0
- data/bin/git-annotate-game +31 -0
- data/bin/git-blame-game +3 -4
- data/bin/git-praise-game +31 -0
- data/features/happy_path.feature +143 -0
- data/features/other_scenarios.feature +244 -0
- data/features/step_definitions/gbc_steps.rb +24 -1
- data/features/support/aruba_ext.rb +41 -0
- data/features/support/env.rb +3 -2
- data/lib/git-blame-game.rb +4 -2
- data/lib/git-blame-game/git_blame_game.rb +107 -48
- data/lib/git-blame-game/version.rb +1 -1
- data/spec/git-blame-game/git_blame_game_spec.rb +46 -0
- data/spec/spec_helper.rb +1 -0
- metadata +19 -7
- data/features/blaming.feature +0 -195
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# git-blame-game
|
2
2
|
|
3
|
+
[]
|
4
|
+
|
3
5
|
<img src="https://github.com/charleseff/git-blame-game/raw/master/public/pensive-kanye.png" />
|
4
6
|
|
5
7
|
git-blame-game is an interactive command-line tool for chaining 'git blame' calls to drill-down to the real culprit for the line of code you care about. When one `git blame` does not tell the whole story.
|
@@ -44,11 +46,11 @@ git-blame-game is an interactive command-line tool for chaining 'git blame' call
|
|
44
46
|
end
|
45
47
|
|
46
48
|
|
47
|
-
Do you need to git blame chain further (y/n) > y
|
49
|
+
Do you need to git blame chain further? (y/n) > y
|
48
50
|
|
49
51
|
1) add.rb
|
50
52
|
|
51
|
-
Enter the number (from 1 to 1) of the file to git blame chain into > 1
|
53
|
+
Enter the number from the above list (from 1 to 1) of the file to git blame chain into > 1
|
52
54
|
|
53
55
|
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
54
56
|
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 2) def add_4(x)
|
@@ -91,12 +93,12 @@ git-blame-game is an interactive command-line tool for chaining 'git blame' call
|
|
91
93
|
puts add_4(9) # should be 13
|
92
94
|
|
93
95
|
|
94
|
-
Do you need to git blame chain further (y/n) > y
|
96
|
+
Do you need to git blame chain further? (y/n) > y
|
95
97
|
|
96
98
|
1) add.rb
|
97
99
|
2) blah.rb
|
98
100
|
|
99
|
-
Enter the number (from 1 to 2) of the file to git blame chain into > 2
|
101
|
+
Enter the number from the above list (from 1 to 2) of the file to git blame chain into > 2
|
100
102
|
|
101
103
|
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 1) def add_4(x)
|
102
104
|
63b41ee4 (Bob Barker 2012-01-14 14:46:53 -0800 2) x + 5
|
@@ -125,7 +127,7 @@ git-blame-game is an interactive command-line tool for chaining 'git blame' call
|
|
125
127
|
puts add_4(9) # should be 13
|
126
128
|
|
127
129
|
|
128
|
-
Do you need to git blame chain further (y/n) > n
|
130
|
+
Do you need to git blame chain further? (y/n) > n
|
129
131
|
|
130
132
|
The responsible commit is:
|
131
133
|
|
data/Rakefile
CHANGED
data/TODO
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
- add special highlighting for in the 'git show' for the line of code (or also the file) that has been chosen to git blame chain into
|
2
|
+
- add ability to go back a step if you made a mistake
|
3
|
+
- (maybe) add support for one-file mode (maybe make it default too?)
|
4
|
+
- add pull request for aruba?
|
5
|
+
- add pull request for colorize (decolorize)
|
data/bin/git-ann-game
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
+
require 'git-blame-game'
|
4
|
+
|
5
|
+
aliases = %w(blame praise annotate ann)
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = <<-END.gsub(/^[ \t]+/m, '')
|
10
|
+
Usage: git-blame-game [options] path/to/filename
|
11
|
+
END
|
12
|
+
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Options:"
|
15
|
+
|
16
|
+
opts.on("-s", "--sha", "--SHA [SHA]", String, "Set initial SHA (defaults to HEAD)") do |sha|
|
17
|
+
options[:sha] = sha
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
21
|
+
puts opts
|
22
|
+
puts "\nAliases: " + aliases.map{|a| ["git-#{a}-game", "git #{a}-game"]}.flatten.join(", ")
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
end.parse!
|
27
|
+
|
28
|
+
path_to_file = ARGV[0]
|
29
|
+
raise OptionParser::MissingArgument.new("You must specify a path to a file ") if not path_to_file
|
30
|
+
|
31
|
+
GitBlameGame.new(path_to_file, options).run
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
+
require 'git-blame-game'
|
4
|
+
|
5
|
+
aliases = %w(blame praise annotate ann)
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = <<-END.gsub(/^[ \t]+/m, '')
|
10
|
+
Usage: git-blame-game [options] path/to/filename
|
11
|
+
END
|
12
|
+
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Options:"
|
15
|
+
|
16
|
+
opts.on("-s", "--sha", "--SHA [SHA]", String, "Set initial SHA (defaults to HEAD)") do |sha|
|
17
|
+
options[:sha] = sha
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
21
|
+
puts opts
|
22
|
+
puts "\nAliases: " + aliases.map{|a| ["git-#{a}-game", "git #{a}-game"]}.flatten.join(", ")
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
end.parse!
|
27
|
+
|
28
|
+
path_to_file = ARGV[0]
|
29
|
+
raise OptionParser::MissingArgument.new("You must specify a path to a file ") if not path_to_file
|
30
|
+
|
31
|
+
GitBlameGame.new(path_to_file, options).run
|
data/bin/git-blame-game
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
+
require 'git-blame-game'
|
3
4
|
|
4
|
-
|
5
|
-
require 'colorize'
|
6
|
-
require 'optparse'
|
7
|
-
require 'git-blame-game/git_blame_game'
|
5
|
+
aliases = %w(blame praise annotate ann)
|
8
6
|
|
9
7
|
options = {}
|
10
8
|
OptionParser.new do |opts|
|
@@ -21,6 +19,7 @@ OptionParser.new do |opts|
|
|
21
19
|
|
22
20
|
opts.on_tail("-h", "--help", "Show this message") do
|
23
21
|
puts opts
|
22
|
+
puts "\nAliases: " + aliases.map{|a| ["git-#{a}-game", "git #{a}-game"]}.flatten.join(", ")
|
24
23
|
exit
|
25
24
|
end
|
26
25
|
|
data/bin/git-praise-game
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
3
|
+
require 'git-blame-game'
|
4
|
+
|
5
|
+
aliases = %w(blame praise annotate ann)
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = <<-END.gsub(/^[ \t]+/m, '')
|
10
|
+
Usage: git-blame-game [options] path/to/filename
|
11
|
+
END
|
12
|
+
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Options:"
|
15
|
+
|
16
|
+
opts.on("-s", "--sha", "--SHA [SHA]", String, "Set initial SHA (defaults to HEAD)") do |sha|
|
17
|
+
options[:sha] = sha
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
21
|
+
puts opts
|
22
|
+
puts "\nAliases: " + aliases.map{|a| ["git-#{a}-game", "git #{a}-game"]}.flatten.join(", ")
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
end.parse!
|
27
|
+
|
28
|
+
path_to_file = ARGV[0]
|
29
|
+
raise OptionParser::MissingArgument.new("You must specify a path to a file ") if not path_to_file
|
30
|
+
|
31
|
+
GitBlameGame.new(path_to_file, options).run
|
@@ -0,0 +1,143 @@
|
|
1
|
+
Feature: The happy path
|
2
|
+
|
3
|
+
Scenario: Happy path
|
4
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
5
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
6
|
+
Then I should see:
|
7
|
+
"""
|
8
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
9
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y)
|
10
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5
|
11
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
12
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
13
|
+
|
14
|
+
(h for help) >
|
15
|
+
"""
|
16
|
+
When I type "3"
|
17
|
+
Then I should see:
|
18
|
+
"""
|
19
|
+
commit 5087eab56af9b0901a1b190de14f29867307c140
|
20
|
+
Author: Danny Dover <developers+danny@foo.com>
|
21
|
+
Date: Sat Jan 14 14:50:06 2012 -0800
|
22
|
+
|
23
|
+
I like y's better
|
24
|
+
|
25
|
+
diff --git a/add.rb b/add.rb
|
26
|
+
index 44be98f..898a812 100644
|
27
|
+
--- a/add.rb
|
28
|
+
+++ b/add.rb
|
29
|
+
@@ -1,5 +1,5 @@
|
30
|
+
module Add
|
31
|
+
- def add_4(x)
|
32
|
+
- x + 5
|
33
|
+
+ def add_4(y)
|
34
|
+
+ y + 5
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
1) add.rb (or 's' for same)
|
40
|
+
|
41
|
+
(h for help) >
|
42
|
+
"""
|
43
|
+
When I type "1"
|
44
|
+
Then I should see:
|
45
|
+
"""
|
46
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
47
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 2) def add_4(x)
|
48
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 3) x + 5
|
49
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
50
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
51
|
+
|
52
|
+
(h for help) >
|
53
|
+
"""
|
54
|
+
When I type "3"
|
55
|
+
Then I should see:
|
56
|
+
"""
|
57
|
+
commit de2a1d78f80e02a515cdd3aa0420dd6ee35b510b
|
58
|
+
Author: Carmen Cummings <developers+carmen@foo.com>
|
59
|
+
Date: Sat Jan 14 14:49:00 2012 -0800
|
60
|
+
|
61
|
+
moving add_4 to module
|
62
|
+
|
63
|
+
diff --git a/add.rb b/add.rb
|
64
|
+
new file mode 100644
|
65
|
+
index 0000000..44be98f
|
66
|
+
--- /dev/null
|
67
|
+
+++ b/add.rb
|
68
|
+
@@ -0,0 +1,5 @@
|
69
|
+
+module Add
|
70
|
+
+ def add_4(x)
|
71
|
+
+ x + 5
|
72
|
+
+ end
|
73
|
+
+end
|
74
|
+
|
75
|
+
diff --git a/blah.rb b/blah.rb
|
76
|
+
index 0424947..38b7511 100644
|
77
|
+
--- a/blah.rb
|
78
|
+
+++ b/blah.rb
|
79
|
+
@@ -1,5 +1,5 @@
|
80
|
+
-def add_4(x)
|
81
|
+
- x + 5
|
82
|
+
-end
|
83
|
+
+$:.unshift(File.dirname(__FILE__))
|
84
|
+
+require 'add'
|
85
|
+
+include Add
|
86
|
+
|
87
|
+
puts add_4(9) # should be 13
|
88
|
+
|
89
|
+
|
90
|
+
1) add.rb (or 's' for same)
|
91
|
+
2) blah.rb
|
92
|
+
|
93
|
+
(h for help) >
|
94
|
+
"""
|
95
|
+
When I type "2"
|
96
|
+
Then I should see:
|
97
|
+
"""
|
98
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 1) def add_4(x)
|
99
|
+
63b41ee4 (Bob Barker 2012-01-14 14:46:53 -0800 2) x + 5
|
100
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 3) end
|
101
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 4)
|
102
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 5) puts add_4(9) # should be 13
|
103
|
+
|
104
|
+
(h for help) >
|
105
|
+
"""
|
106
|
+
When I type "2"
|
107
|
+
Then I should see:
|
108
|
+
"""
|
109
|
+
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
110
|
+
Author: Bob Barker <developers+bob@foo.com>
|
111
|
+
Date: Sat Jan 14 14:46:53 2012 -0800
|
112
|
+
|
113
|
+
being bad
|
114
|
+
|
115
|
+
diff --git a/blah.rb b/blah.rb
|
116
|
+
index 626a42b..0424947 100644
|
117
|
+
--- a/blah.rb
|
118
|
+
+++ b/blah.rb
|
119
|
+
@@ -1,5 +1,5 @@
|
120
|
+
def add_4(x)
|
121
|
+
- x + 4
|
122
|
+
+ x + 5
|
123
|
+
end
|
124
|
+
|
125
|
+
puts add_4(9) # should be 13
|
126
|
+
|
127
|
+
|
128
|
+
1) blah.rb (or 's' for same)
|
129
|
+
|
130
|
+
(h for help) >
|
131
|
+
"""
|
132
|
+
When I type "q"
|
133
|
+
Then I should see:
|
134
|
+
"""
|
135
|
+
The responsible commit is:
|
136
|
+
|
137
|
+
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
138
|
+
Author: Bob Barker <developers+bob@foo.com>
|
139
|
+
Date: Sat Jan 14 14:46:53 2012 -0800
|
140
|
+
|
141
|
+
being bad
|
142
|
+
"""
|
143
|
+
|
@@ -0,0 +1,244 @@
|
|
1
|
+
Feature: Other scenarios
|
2
|
+
|
3
|
+
Scenario: Getting help
|
4
|
+
When I run `bin/git-blame-game --help`
|
5
|
+
Then it should pass with:
|
6
|
+
"""
|
7
|
+
Usage: git-blame-game [options] path/to/filename
|
8
|
+
"""
|
9
|
+
|
10
|
+
Scenario: Without a filepath:
|
11
|
+
When I run `bin/git-blame-game`
|
12
|
+
Then it should fail with:
|
13
|
+
"""
|
14
|
+
missing argument: You must specify a path to a file
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Specifying a file that doesn't exist:
|
18
|
+
When I run `bin/git-blame-game file/that/doesnt/exist.rb`
|
19
|
+
Then it should fail with:
|
20
|
+
"""
|
21
|
+
fatal: no such path file/that/doesnt/exist.rb in HEAD
|
22
|
+
"""
|
23
|
+
|
24
|
+
Scenario: Invalid input on git blame view:
|
25
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
26
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
27
|
+
And I type "foobar"
|
28
|
+
Then I should see:
|
29
|
+
"""
|
30
|
+
Invalid input. Enter:
|
31
|
+
- the line number from the above list (from 1 to 5) you are git blaming.
|
32
|
+
- the sha to git blame chain into.
|
33
|
+
- 'r' to re-view the git blame
|
34
|
+
|
35
|
+
(h for help) >
|
36
|
+
"""
|
37
|
+
|
38
|
+
Scenario: Invalid input on git show view:
|
39
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
40
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
41
|
+
And I type "3"
|
42
|
+
And I type "blah"
|
43
|
+
Then I should see:
|
44
|
+
"""
|
45
|
+
Invalid input. Enter:
|
46
|
+
- 'q' to quit, if you have found the offending commit
|
47
|
+
- the number from the above list (from 1 to 1) of the file to git blame chain into.
|
48
|
+
- the filepath to git blame chain into.
|
49
|
+
- 's' to git blame chain into the 'same' file as before
|
50
|
+
- 'r' to re-view the git show
|
51
|
+
|
52
|
+
(h for help) >
|
53
|
+
"""
|
54
|
+
|
55
|
+
Scenario: With a SHA:
|
56
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
57
|
+
When I run `../../../bin/git-blame-game blah.rb --sha=63b41ee41653991aa00ce9687e3f403efd4c29d4` interactively
|
58
|
+
Then I should see:
|
59
|
+
"""
|
60
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 1) def add_4(x)
|
61
|
+
63b41ee4 (Bob Barker 2012-01-14 14:46:53 -0800 2) x + 5
|
62
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 3) end
|
63
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 4)
|
64
|
+
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 5) puts add_4(9) # should be 13
|
65
|
+
"""
|
66
|
+
|
67
|
+
Scenario: Entering the SHA instead of the number
|
68
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
69
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
70
|
+
When I type "5087eab5"
|
71
|
+
Then I should see:
|
72
|
+
"""
|
73
|
+
commit 5087eab56af9b0901a1b190de14f29867307c140
|
74
|
+
Author: Danny Dover <developers+danny@foo.com>
|
75
|
+
Date: Sat Jan 14 14:50:06 2012 -0800
|
76
|
+
|
77
|
+
I like y's better
|
78
|
+
|
79
|
+
diff --git a/add.rb b/add.rb
|
80
|
+
index 44be98f..898a812 100644
|
81
|
+
--- a/add.rb
|
82
|
+
+++ b/add.rb
|
83
|
+
@@ -1,5 +1,5 @@
|
84
|
+
module Add
|
85
|
+
- def add_4(x)
|
86
|
+
- x + 5
|
87
|
+
+ def add_4(y)
|
88
|
+
+ y + 5
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
"""
|
93
|
+
|
94
|
+
Scenario: Entering 's' for the same file to git blame into
|
95
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
96
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
97
|
+
When I type "3"
|
98
|
+
Then I should see:
|
99
|
+
"""
|
100
|
+
1) add.rb
|
101
|
+
"""
|
102
|
+
When I type "s"
|
103
|
+
Then I should see:
|
104
|
+
"""
|
105
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
106
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 2) def add_4(x)
|
107
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 3) x + 5
|
108
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
109
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
110
|
+
"""
|
111
|
+
|
112
|
+
Scenario: Entering the filename for the file to git blame into:
|
113
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
114
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
115
|
+
When I type "3"
|
116
|
+
Then I should see:
|
117
|
+
"""
|
118
|
+
1) add.rb (or 's' for same)
|
119
|
+
"""
|
120
|
+
When I type "add.rb"
|
121
|
+
Then I should see:
|
122
|
+
"""
|
123
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
124
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 2) def add_4(x)
|
125
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 3) x + 5
|
126
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
127
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
128
|
+
"""
|
129
|
+
|
130
|
+
Scenario: Re-viewing a git blame:
|
131
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
132
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
133
|
+
Then I should see:
|
134
|
+
"""
|
135
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
136
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y)
|
137
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5
|
138
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
139
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
140
|
+
"""
|
141
|
+
When I type "r"
|
142
|
+
Then I should see:
|
143
|
+
"""
|
144
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
145
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y)
|
146
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5
|
147
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
148
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
149
|
+
"""
|
150
|
+
|
151
|
+
Scenario: Re-viewing a git show:
|
152
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
153
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
154
|
+
And I type "3"
|
155
|
+
Then I should see:
|
156
|
+
"""
|
157
|
+
commit 5087eab56af9b0901a1b190de14f29867307c140
|
158
|
+
Author: Danny Dover <developers+danny@foo.com>
|
159
|
+
Date: Sat Jan 14 14:50:06 2012 -0800
|
160
|
+
|
161
|
+
I like y's better
|
162
|
+
|
163
|
+
diff --git a/add.rb b/add.rb
|
164
|
+
index 44be98f..898a812 100644
|
165
|
+
--- a/add.rb
|
166
|
+
+++ b/add.rb
|
167
|
+
@@ -1,5 +1,5 @@
|
168
|
+
module Add
|
169
|
+
- def add_4(x)
|
170
|
+
- x + 5
|
171
|
+
+ def add_4(y)
|
172
|
+
+ y + 5
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
1) add.rb (or 's' for same)
|
178
|
+
"""
|
179
|
+
When I type "r"
|
180
|
+
Then I should see:
|
181
|
+
"""
|
182
|
+
commit 5087eab56af9b0901a1b190de14f29867307c140
|
183
|
+
Author: Danny Dover <developers+danny@foo.com>
|
184
|
+
Date: Sat Jan 14 14:50:06 2012 -0800
|
185
|
+
|
186
|
+
I like y's better
|
187
|
+
|
188
|
+
diff --git a/add.rb b/add.rb
|
189
|
+
index 44be98f..898a812 100644
|
190
|
+
--- a/add.rb
|
191
|
+
+++ b/add.rb
|
192
|
+
@@ -1,5 +1,5 @@
|
193
|
+
module Add
|
194
|
+
- def add_4(x)
|
195
|
+
- x + 5
|
196
|
+
+ def add_4(y)
|
197
|
+
+ y + 5
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
1) add.rb (or 's' for same)
|
203
|
+
"""
|
204
|
+
|
205
|
+
Scenario: Getting help interactively for git blame:
|
206
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
207
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
208
|
+
Then I should see:
|
209
|
+
"""
|
210
|
+
(h for help) >
|
211
|
+
"""
|
212
|
+
When I type "h"
|
213
|
+
Then I should see:
|
214
|
+
"""
|
215
|
+
Enter:
|
216
|
+
- the line number from the above list (from 1 to 5) you are git blaming.
|
217
|
+
- the sha to git blame chain into.
|
218
|
+
- 'r' to re-view the git blame
|
219
|
+
|
220
|
+
(h for help) >
|
221
|
+
"""
|
222
|
+
|
223
|
+
Scenario: Getting help interactively for git show:
|
224
|
+
Given I cd to "test/fixtures/sample_git_repo"
|
225
|
+
When I run `../../../bin/git-blame-game add.rb` interactively
|
226
|
+
And I type "3"
|
227
|
+
Then I should see:
|
228
|
+
"""
|
229
|
+
(h for help) >
|
230
|
+
"""
|
231
|
+
When I type "h"
|
232
|
+
Then I should see:
|
233
|
+
"""
|
234
|
+
Enter:
|
235
|
+
- 'q' to quit, if you have found the offending commit
|
236
|
+
- the number from the above list (from 1 to 1) of the file to git blame chain into.
|
237
|
+
- the filepath to git blame chain into.
|
238
|
+
- 's' to git blame chain into the 'same' file as before
|
239
|
+
- 'r' to re-view the git show
|
240
|
+
|
241
|
+
(h for help) >
|
242
|
+
"""
|
243
|
+
|
244
|
+
|
@@ -1,3 +1,26 @@
|
|
1
|
+
World(ArubaExt)
|
2
|
+
|
1
3
|
Then /^the output should contain, ignoring spaces:$/ do |expected|
|
2
|
-
assert_partial_output(expected.gsub("\s",''), all_output.gsub("\s",''))
|
4
|
+
assert_partial_output(expected.gsub("\s", ''), all_output.gsub("\s", ''))
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^I should see:$/ do |expected|
|
8
|
+
assert_seen(expected)
|
9
|
+
end
|
10
|
+
|
11
|
+
Then /^the next bit of output should contain, ignoring spaces:$/ do |expected|
|
12
|
+
assert_seen(expected)
|
13
|
+
end
|
14
|
+
|
15
|
+
def assert_seen(expected)
|
16
|
+
@seen_output ||= ''
|
17
|
+
expected = unescape(expected.gsub("\s", ''))
|
18
|
+
wait_until_expectation do
|
19
|
+
@all_output = only_processes[0].output(@aruba_keep_ansi)
|
20
|
+
|
21
|
+
actual = unescape(@all_output[@seen_output.size..-1].gsub("\s", ''))
|
22
|
+
|
23
|
+
actual.should include(expected)
|
24
|
+
end
|
25
|
+
@seen_output = @all_output
|
3
26
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# extension methods for Aruba
|
2
|
+
module ArubaExt
|
3
|
+
|
4
|
+
def wait_until(seconds = 5)
|
5
|
+
timeout(seconds) { yield }
|
6
|
+
end
|
7
|
+
|
8
|
+
def timeout(seconds = 50, &block)
|
9
|
+
start_time = Time.now
|
10
|
+
|
11
|
+
result = nil
|
12
|
+
|
13
|
+
until result
|
14
|
+
return result if result = yield
|
15
|
+
|
16
|
+
delay = seconds - (Time.now - start_time)
|
17
|
+
if delay <= 0
|
18
|
+
raise TimeoutError, "timed out"
|
19
|
+
end
|
20
|
+
|
21
|
+
sleep(0.05)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def wait_until_expectation
|
26
|
+
begin
|
27
|
+
exception = nil
|
28
|
+
wait_until do
|
29
|
+
begin
|
30
|
+
yield
|
31
|
+
true
|
32
|
+
rescue RSpec::Expectations::ExpectationNotMetError => e
|
33
|
+
exception = e
|
34
|
+
false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
rescue TimeoutError
|
38
|
+
raise exception
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# NOTE: these features assumes a standard install of git with no .gitconfig options, which may alter git output
|
2
|
+
|
1
3
|
require 'aruba/cucumber'
|
2
4
|
|
3
5
|
def unzip_git_repo_if_needed!
|
@@ -15,6 +17,5 @@ end
|
|
15
17
|
|
16
18
|
Before do
|
17
19
|
unzip_git_repo_if_needed!
|
18
|
-
|
19
20
|
set_relative_dir_for_aruba!
|
20
|
-
end
|
21
|
+
end
|
data/lib/git-blame-game.rb
CHANGED
@@ -5,76 +5,135 @@ class GitBlameGame
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def run
|
8
|
-
|
9
|
-
|
10
|
-
end
|
8
|
+
loop do
|
9
|
+
p_flush("\n")
|
11
10
|
|
12
|
-
|
11
|
+
sha_to_show = show_git_blame_and_prompt_for_sha
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
out = run_idempotent_git_command("git blame #{@sha} -- #{@path_to_file}")
|
17
|
-
exit $?.exitstatus unless $?.success?
|
13
|
+
p_flush("\n")
|
14
|
+
files_changed = `git show --pretty="format:" --name-only #{sha_to_show}`.split("\n")[1..-1]
|
18
15
|
|
19
|
-
|
20
|
-
|
16
|
+
@path_to_file = prompt_for_file(files_changed, sha_to_show)
|
17
|
+
@sha = "#{sha_to_show}^"
|
18
|
+
end
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
private
|
22
|
+
def show_git_blame_and_prompt_for_sha
|
23
|
+
git_blame_out = `#{git_blame_cmd}`
|
24
|
+
exit $?.exitstatus unless $?.success?
|
25
|
+
sha_list = get_sha_list(git_blame_out)
|
26
|
+
print_git_blame_and_prompt
|
27
|
+
prompt_for_sha(sha_list)
|
28
|
+
end
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
def prompt_for_sha(shas)
|
31
|
+
loop do
|
32
|
+
input = $stdin.gets.strip
|
33
|
+
# sha was entered, return it:
|
34
|
+
return input if shas.include? input
|
35
|
+
|
36
|
+
if input =~ /\A\d+\Z/
|
37
|
+
input = input.to_i
|
38
|
+
return shas[input - 1] if input <= shas.count && input >= 1
|
39
|
+
end
|
40
|
+
|
41
|
+
if input == 'r'
|
42
|
+
print_git_blame_and_prompt
|
43
|
+
elsif input == 'h'
|
44
|
+
p_flush prompt_for_sha_message(shas.count)
|
45
|
+
else
|
46
|
+
p_flush "\nInvalid input. " + prompt_for_sha_message(shas.count)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
28
50
|
|
29
|
-
|
30
|
-
|
51
|
+
def print_git_blame_and_prompt
|
52
|
+
system git_blame_cmd
|
53
|
+
p_flush "\n" + simple_prompt
|
54
|
+
end
|
31
55
|
|
32
|
-
|
56
|
+
def git_blame_cmd
|
57
|
+
"git blame #{@sha} -- #{@path_to_file}"
|
33
58
|
end
|
34
59
|
|
35
|
-
|
36
|
-
print "\n" + gbc_color("Do you need to git blame chain further (y/n) >") + ' '
|
37
|
-
input = $stdin.gets.strip.downcase
|
38
|
-
until %w{y n}.include?(input)
|
39
|
-
print "\n" + gbc_color("Invalid input. Enter y or n >") + ' '
|
40
|
-
input = $stdin.gets.strip.downcase
|
41
|
-
end
|
60
|
+
GIT_BLAME_REGEX = /(.+?) /
|
42
61
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
exit 0
|
47
|
-
end
|
62
|
+
def get_sha_list(git_blame_out)
|
63
|
+
git_blame_out.strip.split("\n").map { |line| line[GIT_BLAME_REGEX, 1] }
|
64
|
+
end
|
48
65
|
|
49
|
-
|
50
|
-
files_changed
|
51
|
-
|
52
|
-
|
66
|
+
def prompt_for_file(files_changed, sha)
|
67
|
+
print_file_prompt(files_changed, sha)
|
68
|
+
|
69
|
+
loop do
|
70
|
+
input = $stdin.gets.strip
|
71
|
+
if input == 'q'
|
72
|
+
p_flush "\n" + color("The responsible commit is:") + "\n\n"
|
73
|
+
system "git log #{sha} -n 1"
|
74
|
+
exit 0
|
75
|
+
end
|
76
|
+
return @path_to_file if input == 's'
|
77
|
+
return input if files_changed.include? input
|
78
|
+
|
79
|
+
if input =~ /\A\d+\Z/
|
80
|
+
input = input.to_i
|
81
|
+
return files_changed[input-1] if input >= 1 && input <= files_changed.count
|
82
|
+
end
|
83
|
+
|
84
|
+
if input == 'r'
|
85
|
+
print_file_prompt(files_changed, sha)
|
86
|
+
elsif input == 'h'
|
87
|
+
p_flush prompt_for_file_message(files_changed.count)
|
88
|
+
else
|
89
|
+
p_flush "\nInvalid input. " + prompt_for_file_message(files_changed.count)
|
90
|
+
end
|
53
91
|
end
|
92
|
+
end
|
54
93
|
|
55
|
-
|
56
|
-
|
57
|
-
|
94
|
+
def print_file_prompt(files, sha)
|
95
|
+
system "git show #{sha}"
|
96
|
+
print("\n")
|
97
|
+
files.each_with_index do |file, index|
|
98
|
+
line = sprintf("%3d) #{file}", index+1)
|
99
|
+
line += ' ' + orange_color("(or 's' for same)") if file == @path_to_file
|
100
|
+
print line + "\n"
|
58
101
|
end
|
102
|
+
p_flush "\n" + simple_prompt
|
103
|
+
end
|
59
104
|
|
60
|
-
|
105
|
+
def prompt_for_file_message(count)
|
106
|
+
"Enter:\n" +
|
107
|
+
" - 'q' to quit, if you have found the offending commit\n" +
|
108
|
+
" - the number from the above list (from 1 to #{count}) of the file to git blame chain into.\n" +
|
109
|
+
" - the filepath to git blame chain into.\n" +
|
110
|
+
" - 's' to git blame chain into the 'same' file as before\n" +
|
111
|
+
" - 'r' to re-view the git show\n\n" +
|
112
|
+
simple_prompt
|
113
|
+
end
|
61
114
|
|
115
|
+
def simple_prompt
|
116
|
+
color("(h for help) >") + ' '
|
62
117
|
end
|
63
118
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
input
|
119
|
+
def prompt_for_sha_message(count)
|
120
|
+
"Enter:\n" +
|
121
|
+
" - the line number from the above list (from 1 to #{count}) you are git blaming.\n" +
|
122
|
+
" - the sha to git blame chain into.\n" +
|
123
|
+
" - 'r' to re-view the git blame\n\n" + simple_prompt
|
70
124
|
end
|
71
125
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
126
|
+
def p_flush(str)
|
127
|
+
$stdout.print str
|
128
|
+
$stdout.flush
|
75
129
|
end
|
76
130
|
|
77
|
-
def
|
131
|
+
def color(s)
|
78
132
|
s.colorize(:color => :light_white, :background => :magenta)
|
79
133
|
end
|
134
|
+
|
135
|
+
def orange_color(s)
|
136
|
+
s.colorize(:color => :yellow, :background => :black)
|
137
|
+
end
|
138
|
+
|
80
139
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GitBlameGame do
|
4
|
+
|
5
|
+
let(:git_blame_game) { GitBlameGame.new('some_file') }
|
6
|
+
let(:sha_list) { %w(de2a1d78 5087eab5 5087eab5 de2a1d78 de2a1d78) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
$stdout.stub(:print)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#get_sha_list" do
|
13
|
+
let(:git_blame_out) {
|
14
|
+
<<-END.gsub(/^[ \t]+/m, '')
|
15
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
16
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y)
|
17
|
+
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5
|
18
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
19
|
+
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
20
|
+
END
|
21
|
+
}
|
22
|
+
|
23
|
+
it "should return a list of shas" do
|
24
|
+
git_blame_game.send(:get_sha_list,git_blame_out).should == sha_list
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "prompt_for_sha" do
|
29
|
+
before do
|
30
|
+
$stdin.should_receive(:gets).and_return(input)
|
31
|
+
end
|
32
|
+
context "when user enters a correct sha" do
|
33
|
+
let(:input) { '5087eab5' }
|
34
|
+
it "should return the correct sha" do
|
35
|
+
git_blame_game.send(:prompt_for_sha, sha_list).should == '5087eab5'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
context "when user enters a correct number" do
|
39
|
+
let(:input) { '1' }
|
40
|
+
it "should return the correct sha" do
|
41
|
+
git_blame_game.send(:prompt_for_sha, sha_list).should == 'de2a1d78'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'git-blame-game'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-blame-game
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aruba
|
16
|
-
requirement: &
|
16
|
+
requirement: &18258680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18258680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: colorize
|
27
|
-
requirement: &
|
27
|
+
requirement: &18257780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,29 +32,41 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *18257780
|
36
36
|
description: When one `git blame` is not enough
|
37
37
|
email:
|
38
38
|
- charles.finkel@gmail.com
|
39
39
|
executables:
|
40
|
+
- git-ann-game
|
41
|
+
- git-annotate-game
|
40
42
|
- git-blame-game
|
43
|
+
- git-praise-game
|
41
44
|
extensions: []
|
42
45
|
extra_rdoc_files: []
|
43
46
|
files:
|
44
47
|
- .gitignore
|
45
48
|
- .rvmrc
|
49
|
+
- .travis.yml
|
46
50
|
- Gemfile
|
47
51
|
- README.md
|
48
52
|
- Rakefile
|
53
|
+
- TODO
|
54
|
+
- bin/git-ann-game
|
55
|
+
- bin/git-annotate-game
|
49
56
|
- bin/git-blame-game
|
50
|
-
-
|
57
|
+
- bin/git-praise-game
|
58
|
+
- features/happy_path.feature
|
59
|
+
- features/other_scenarios.feature
|
51
60
|
- features/step_definitions/gbc_steps.rb
|
61
|
+
- features/support/aruba_ext.rb
|
52
62
|
- features/support/env.rb
|
53
63
|
- git-blame-game.gemspec
|
54
64
|
- lib/git-blame-game.rb
|
55
65
|
- lib/git-blame-game/git_blame_game.rb
|
56
66
|
- lib/git-blame-game/version.rb
|
57
67
|
- public/pensive-kanye.png
|
68
|
+
- spec/git-blame-game/git_blame_game_spec.rb
|
69
|
+
- spec/spec_helper.rb
|
58
70
|
- test/fixtures/sample_git_repo.zip
|
59
71
|
homepage: https://github.com/charleseff/git-blame-game
|
60
72
|
licenses: []
|
data/features/blaming.feature
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
Feature: Blaming
|
2
|
-
|
3
|
-
Scenario: Getting help
|
4
|
-
When I run `bin/git-blame-game --help`
|
5
|
-
Then it should pass with:
|
6
|
-
"""
|
7
|
-
Usage: git-blame-game [options] path/to/filename
|
8
|
-
"""
|
9
|
-
|
10
|
-
Scenario: Without a filepath:
|
11
|
-
When I run `bin/git-blame-game`
|
12
|
-
Then it should fail with:
|
13
|
-
"""
|
14
|
-
missing argument: You must specify a path to a file
|
15
|
-
"""
|
16
|
-
|
17
|
-
Scenario: Specifying a file that doesn't exist:
|
18
|
-
When I run `bin/git-blame-game file/that/doesnt/exist.rb`
|
19
|
-
Then it should fail with:
|
20
|
-
"""
|
21
|
-
fatal: no such path file/that/doesnt/exist.rb in HEAD
|
22
|
-
"""
|
23
|
-
|
24
|
-
Scenario: Without a SHA:
|
25
|
-
Given I cd to "test/fixtures/sample_git_repo"
|
26
|
-
When I run `../../../bin/git-blame-game add.rb` interactively
|
27
|
-
When I type "foobar"
|
28
|
-
When I type "3"
|
29
|
-
When I type "blah"
|
30
|
-
When I type "y"
|
31
|
-
When I type "1"
|
32
|
-
When I type "3"
|
33
|
-
When I type "y"
|
34
|
-
When I type "2"
|
35
|
-
When I type "2"
|
36
|
-
When I type "n"
|
37
|
-
Then the output should contain, ignoring spaces:
|
38
|
-
"""
|
39
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
40
|
-
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y)
|
41
|
-
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5
|
42
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
43
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
44
|
-
|
45
|
-
Which line are you concerned with? (1 to 5) >
|
46
|
-
Invalid input. Enter a number from 1 to 5 >
|
47
|
-
commit 5087eab56af9b0901a1b190de14f29867307c140 (HEAD, master)
|
48
|
-
Author: Danny Dover <developers+danny@foo.com>
|
49
|
-
Date: Sat Jan 14 14:50:06 2012 -0800
|
50
|
-
|
51
|
-
I like y's better
|
52
|
-
|
53
|
-
diff --git a/add.rb b/add.rb
|
54
|
-
index 44be98f..898a812 100644
|
55
|
-
--- a/add.rb
|
56
|
-
+++ b/add.rb
|
57
|
-
@@ -1,5 +1,5 @@
|
58
|
-
module Add
|
59
|
-
- def add_4(x)
|
60
|
-
- x + 5
|
61
|
-
+ def add_4(y)
|
62
|
-
+ y + 5
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
Do you need to git blame chain further (y/n) >
|
68
|
-
Invalid input. Enter y or n >
|
69
|
-
1) add.rb
|
70
|
-
|
71
|
-
Enter the number (from 1 to 1) of the file to git blame chain into >
|
72
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add
|
73
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 2) def add_4(x)
|
74
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 3) x + 5
|
75
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end
|
76
|
-
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end
|
77
|
-
|
78
|
-
Which line are you concerned with? (1 to 5) >
|
79
|
-
commit de2a1d78f80e02a515cdd3aa0420dd6ee35b510b
|
80
|
-
Author: Carmen Cummings <developers+carmen@foo.com>
|
81
|
-
Date: Sat Jan 14 14:49:00 2012 -0800
|
82
|
-
|
83
|
-
moving add_4 to module
|
84
|
-
|
85
|
-
diff --git a/add.rb b/add.rb
|
86
|
-
new file mode 100644
|
87
|
-
index 0000000..44be98f
|
88
|
-
--- /dev/null
|
89
|
-
+++ b/add.rb
|
90
|
-
@@ -0,0 +1,5 @@
|
91
|
-
+module Add
|
92
|
-
+ def add_4(x)
|
93
|
-
+ x + 5
|
94
|
-
+ end
|
95
|
-
+end
|
96
|
-
|
97
|
-
diff --git a/blah.rb b/blah.rb
|
98
|
-
index 0424947..38b7511 100644
|
99
|
-
--- a/blah.rb
|
100
|
-
+++ b/blah.rb
|
101
|
-
@@ -1,5 +1,5 @@
|
102
|
-
-def add_4(x)
|
103
|
-
- x + 5
|
104
|
-
-end
|
105
|
-
+$:.unshift(File.dirname(__FILE__))
|
106
|
-
+require 'add'
|
107
|
-
+include Add
|
108
|
-
|
109
|
-
puts add_4(9) # should be 13
|
110
|
-
|
111
|
-
|
112
|
-
Do you need to git blame chain further (y/n) >
|
113
|
-
1) add.rb
|
114
|
-
2) blah.rb
|
115
|
-
|
116
|
-
Enter the number (from 1 to 2) of the file to git blame chain into >
|
117
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 1) def add_4(x)
|
118
|
-
63b41ee4 (Bob Barker 2012-01-14 14:46:53 -0800 2) x + 5
|
119
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 3) end
|
120
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 4)
|
121
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 5) puts add_4(9) # should be 13
|
122
|
-
|
123
|
-
Which line are you concerned with? (1 to 5) >
|
124
|
-
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
125
|
-
Author: Bob Barker <developers+bob@foo.com>
|
126
|
-
Date: Sat Jan 14 14:46:53 2012 -0800
|
127
|
-
|
128
|
-
being bad
|
129
|
-
|
130
|
-
diff --git a/blah.rb b/blah.rb
|
131
|
-
index 626a42b..0424947 100644
|
132
|
-
--- a/blah.rb
|
133
|
-
+++ b/blah.rb
|
134
|
-
@@ -1,5 +1,5 @@
|
135
|
-
def add_4(x)
|
136
|
-
- x + 4
|
137
|
-
+ x + 5
|
138
|
-
end
|
139
|
-
|
140
|
-
puts add_4(9) # should be 13
|
141
|
-
|
142
|
-
|
143
|
-
Do you need to git blame chain further (y/n) >
|
144
|
-
The responsible commit is:
|
145
|
-
|
146
|
-
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
147
|
-
Author: Bob Barker <developers+bob@foo.com>
|
148
|
-
Date: Sat Jan 14 14:46:53 2012 -0800
|
149
|
-
|
150
|
-
being bad
|
151
|
-
|
152
|
-
"""
|
153
|
-
|
154
|
-
Scenario: With a SHA:
|
155
|
-
Given I cd to "test/fixtures/sample_git_repo"
|
156
|
-
When I run `../../../bin/git-blame-game blah.rb --sha=63b41ee41653991aa00ce9687e3f403efd4c29d4` interactively
|
157
|
-
When I type "2"
|
158
|
-
When I type "n"
|
159
|
-
Then the output should contain, ignoring spaces:
|
160
|
-
"""
|
161
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 1) def add_4(x)
|
162
|
-
63b41ee4 (Bob Barker 2012-01-14 14:46:53 -0800 2) x + 5
|
163
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 3) end
|
164
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 4)
|
165
|
-
^f603a9a (Alice Amos 2012-01-14 14:46:18 -0800 5) puts add_4(9) # should be 13
|
166
|
-
|
167
|
-
Which line are you concerned with? (1 to 5) >
|
168
|
-
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
169
|
-
Author: Bob Barker <developers+bob@foo.com>
|
170
|
-
Date: Sat Jan 14 14:46:53 2012 -0800
|
171
|
-
|
172
|
-
being bad
|
173
|
-
|
174
|
-
diff --git a/blah.rb b/blah.rb
|
175
|
-
index 626a42b..0424947 100644
|
176
|
-
--- a/blah.rb
|
177
|
-
+++ b/blah.rb
|
178
|
-
@@ -1,5 +1,5 @@
|
179
|
-
def add_4(x)
|
180
|
-
- x + 4
|
181
|
-
+ x + 5
|
182
|
-
end
|
183
|
-
|
184
|
-
puts add_4(9) # should be 13
|
185
|
-
|
186
|
-
|
187
|
-
Do you need to git blame chain further (y/n) >
|
188
|
-
The responsible commit is:
|
189
|
-
|
190
|
-
commit 63b41ee41653991aa00ce9687e3f403efd4c29d4
|
191
|
-
Author: Bob Barker <developers+bob@foo.com>
|
192
|
-
Date: Sat Jan 14 14:46:53 2012 -0800
|
193
|
-
|
194
|
-
being bad
|
195
|
-
"""
|