Fix git log command redundant flags
* --pretty=online does not have any effect on presence of -L * Fix specs to use more explicit wording / format preparing followup change
This commit is contained in:
parent
c0157bf796
commit
8f13810812
2 changed files with 12 additions and 9 deletions
|
@ -49,7 +49,7 @@ module Mutant
|
|||
# @api private
|
||||
def touches?(path, line_range)
|
||||
command = %W[
|
||||
git log --pretty=oneline
|
||||
git log
|
||||
#{from}...#{to}
|
||||
-L #{line_range.begin},#{line_range.end}:#{path}
|
||||
]
|
||||
|
|
|
@ -18,23 +18,26 @@ describe Mutant::Repository::Diff do
|
|||
subject { object.touches?(path, line_range) }
|
||||
|
||||
before do
|
||||
expect(Open3).to receive(:capture2).with(
|
||||
*expected_command,
|
||||
binmode: true
|
||||
).and_return([stdout, status])
|
||||
expect(Open3).to receive(:capture2)
|
||||
.ordered
|
||||
.with(*expected_git_log_command, binmode: true)
|
||||
.and_return([stdout, status])
|
||||
end
|
||||
|
||||
let(:expected_command) do
|
||||
let(:expected_git_log_command) do
|
||||
%w[
|
||||
git log --pretty=oneline from_rev...to_rev -L 1,2:foo.rb
|
||||
git log from_rev...to_rev -L 1,2:foo.rb
|
||||
]
|
||||
end
|
||||
|
||||
context 'on failure of git command' do
|
||||
context 'on failure of git log command' do
|
||||
let(:success?) { false }
|
||||
|
||||
it 'raises error' do
|
||||
expect { subject }.to raise_error(Mutant::Repository::RepositoryError, "Command #{expected_command} failed!")
|
||||
expect { subject }.to raise_error(
|
||||
Mutant::Repository::RepositoryError,
|
||||
"Command #{expected_git_log_command} failed!"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue