pre-commit 0.19.0 → 0.20.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.
@@ -1,6 +1,9 @@
1
+ require "pre-commit/configuration/top_level"
2
+
1
3
  module PreCommit
2
4
  module Utils
3
5
  module StagedFiles
6
+ include PreCommit::Configuration::TopLevel
4
7
 
5
8
  def set_staged_files(*args)
6
9
  case args[0].to_s
@@ -35,12 +38,14 @@ module PreCommit
35
38
  end
36
39
 
37
40
  def filter_files(files)
38
- files.reject do |f|
39
- File.directory?(f) ||
41
+ files.reject do |file|
42
+ !File.exists?(file) ||
43
+ File.directory?(file) ||
40
44
  (
41
- size = File.size(f)
42
- size > 1_000_000 || (size > 20 && binary?(f))
43
- )
45
+ size = File.size(file)
46
+ size > 1_000_000 || (size > 20 && binary?(file))
47
+ ) ||
48
+ repo_ignores.any? { |ignore| File.fnmatch?(ignore, file) }
44
49
  end
45
50
  end
46
51
 
@@ -56,6 +61,16 @@ module PreCommit
56
61
  Dir["**/*"]
57
62
  end
58
63
 
64
+ def repo_ignores_file
65
+ File.join(top_level, ".pre_commit.ignore")
66
+ end
67
+
68
+ def repo_ignores
69
+ @repo_ignores ||= File.read(repo_ignores_file).split("\n").compact
70
+ rescue Errno::ENOENT
71
+ @repo_ignores = []
72
+ end
73
+
59
74
  end
60
75
  end
61
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pre-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shajith Chacko, Josh Lubaway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-02 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pluginator
@@ -163,8 +163,12 @@ files:
163
163
  - lib/pre-commit/cli.rb
164
164
  - lib/pre-commit/configuration.rb
165
165
  - lib/pre-commit/configuration/providers.rb
166
+ - lib/pre-commit/configuration/top_level.rb
167
+ - lib/pre-commit/error_list.rb
166
168
  - lib/pre-commit/installer.rb
169
+ - lib/pre-commit/line.rb
167
170
  - lib/pre-commit/list_evaluator.rb
171
+ - lib/pre-commit/message.rb
168
172
  - lib/pre-commit/plugins_list.rb
169
173
  - lib/pre-commit/runner.rb
170
174
  - lib/pre-commit/support/closure/compiler.jar