summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands/autoupdate.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-04 03:57:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-04 03:57:49 +0000
commitd6cacb1f6ae346ce54a5116d76a7d087bb6381a5 (patch)
treefdb6f1b1b847180a234439c3f39ce5d93da8e84e /pre_commit/commands/autoupdate.py
parentAdding upstream version 2.15.0. (diff)
downloadpre-commit-d6cacb1f6ae346ce54a5116d76a7d087bb6381a5.tar.xz
pre-commit-d6cacb1f6ae346ce54a5116d76a7d087bb6381a5.zip
Adding upstream version 2.16.0.upstream/2.16.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/commands/autoupdate.py')
-rw-r--r--pre_commit/commands/autoupdate.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py
index 33a3473..5cb978e 100644
--- a/pre_commit/commands/autoupdate.py
+++ b/pre_commit/commands/autoupdate.py
@@ -36,24 +36,36 @@ class RevInfo(NamedTuple):
return cls(config['repo'], config['rev'], None)
def update(self, tags_only: bool, freeze: bool) -> 'RevInfo':
+ git_cmd = ('git', *git.NO_FS_MONITOR)
+
if tags_only:
- tag_cmd = ('git', 'describe', 'FETCH_HEAD', '--tags', '--abbrev=0')
+ tag_cmd = (
+ *git_cmd, 'describe',
+ 'FETCH_HEAD', '--tags', '--abbrev=0',
+ )
else:
- tag_cmd = ('git', 'describe', 'FETCH_HEAD', '--tags', '--exact')
+ tag_cmd = (
+ *git_cmd, 'describe',
+ 'FETCH_HEAD', '--tags', '--exact',
+ )
with tmpdir() as tmp:
git.init_repo(tmp, self.repo)
- cmd_output_b('git', 'fetch', 'origin', 'HEAD', '--tags', cwd=tmp)
+ cmd_output_b(
+ *git_cmd, 'fetch', 'origin', 'HEAD', '--tags',
+ cwd=tmp,
+ )
try:
rev = cmd_output(*tag_cmd, cwd=tmp)[1].strip()
except CalledProcessError:
- cmd = ('git', 'rev-parse', 'FETCH_HEAD')
+ cmd = (*git_cmd, 'rev-parse', 'FETCH_HEAD')
rev = cmd_output(*cmd, cwd=tmp)[1].strip()
frozen = None
if freeze:
- exact = cmd_output('git', 'rev-parse', rev, cwd=tmp)[1].strip()
+ exact_rev_cmd = (*git_cmd, 'rev-parse', rev)
+ exact = cmd_output(*exact_rev_cmd, cwd=tmp)[1].strip()
if exact != rev:
rev, frozen = exact, rev
return self._replace(rev=rev, frozen=frozen)