MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / get_changed_files

Function get_changed_files

pre_commit/git.py:158–167  ·  view source on GitHub ↗
(old: str, new: str)

Source from the content-addressed store, hash-verified

156
157
158def get_changed_files(old: str, new: str) -> list[str]:
159 diff_cmd = ('git', 'diff', '--name-only', '--no-ext-diff', '-z')
160 try:
161 _, out, _ = cmd_output(*diff_cmd, f'{old}...{new}')
162 except CalledProcessError: # pragma: no cover (new git)
163 # on newer git where old and new do not have a merge base git fails
164 # so we try a full diff (this is what old git did for us!)
165 _, out, _ = cmd_output(*diff_cmd, f'{old}..{new}')
166
167 return zsplit(out)
168
169
170def head_rev(remote: str) -> str:

Callers

nothing calls this directly

Calls 2

cmd_outputFunction · 0.90
zsplitFunction · 0.85

Tested by

no test coverage detected