Skip to content

Commit ddb4b5f

Browse files
committed
Run LineEndings specs on Git 2.10 or newer
It turns on the `--eol` flag on `git ls-files` is only available on Git 2.10 or newer. Until someone modifies the implementation to support older git versions, skip the tests if running Git < 2.10.
1 parent 24a851f commit ddb4b5f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/overcommit/hook/pre_commit/line_endings.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Overcommit::Hook::PreCommit
22
# Checks for line endings in files.
3+
#
4+
# WARNING: Works with Git 2.10.0 or newer.
35
class LineEndings < Base
46
def run
57
messages = []

spec/overcommit/hook/pre_commit/line_endings_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
)
1313
)
1414
end
15+
1516
let(:context) { double('context') }
1617
subject { described_class.new(config, context) }
1718
let(:eol) { "\n" }
1819
let(:staged_file) { 'filename.txt' }
1920

2021
before do
22+
skip('Skip LineEndings tests for Git < 2.10') if Overcommit::GIT_VERSION < '2.10'
2123
subject.stub(:applicable_files).and_return([staged_file])
2224
end
2325

0 commit comments

Comments
 (0)