Skip to content

Commit b368fbd

Browse files
authored
Merge pull request #1704 from Vynce/ignore-submodules
Improve performance by ignoring submodules
2 parents 8419586 + 120d602 commit b368fbd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pre_commit/commands/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ def _all_filenames(args: argparse.Namespace) -> Collection[str]:
258258

259259

260260
def _get_diff() -> bytes:
261-
_, out, _ = cmd_output_b('git', 'diff', '--no-ext-diff', retcode=None)
261+
_, out, _ = cmd_output_b(
262+
'git', 'diff', '--no-ext-diff', '--ignore-submodules', retcode=None,
263+
)
262264
return out
263265

264266

pre_commit/git.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def get_staged_files(cwd: Optional[str] = None) -> List[str]:
130130

131131

132132
def intent_to_add_files() -> List[str]:
133-
_, stdout, _ = cmd_output('git', 'status', '--porcelain', '-z')
133+
_, stdout, _ = cmd_output(
134+
'git', 'status', '--ignore-submodules', '--porcelain', '-z',
135+
)
134136
parts = list(reversed(zsplit(stdout)))
135137
intent_to_add = []
136138
while parts:

0 commit comments

Comments
 (0)