@@ -305,3 +305,32 @@ def test_get_changed_files():
305305 '3387edbb1288a580b37fe25225aa0b856b18ad1a' ,
306306 )
307307 assert files == ['CHANGELOG.md' , 'setup.py' ]
308+
309+
310+ def test_lots_of_files (mock_out_store_directory , tmpdir_factory ):
311+ # windows xargs seems to have a bug, here's a regression test for
312+ # our workaround
313+ git_path = make_consuming_repo (tmpdir_factory , 'python_hooks_repo' )
314+ with cwd (git_path ):
315+ # Override files so we run against them
316+ with io .open (
317+ '.pre-commit-config.yaml' , 'a+' ,
318+ ) as config_file :
319+ config_file .write (' files: ""\n ' )
320+
321+ # Write a crap ton of files
322+ for i in range (400 ):
323+ filename = '{0}{1}' .format ('a' * 100 , i )
324+ open (filename , 'w' ).close ()
325+
326+ cmd_output ('bash' , '-c' , 'git add .' )
327+ install (Runner (git_path ))
328+
329+ # Don't want to write to home directory
330+ env = dict (os .environ , ** {'PRE_COMMIT_HOME' : tmpdir_factory .get ()})
331+ cmd_output (
332+ 'git' , 'commit' , '-m' , 'Commit!' ,
333+ # git commit puts pre-commit to stderr
334+ stderr = subprocess .STDOUT ,
335+ env = env ,
336+ )
0 commit comments