From db80394edb5825e82027a2cb6ff69628fb85a83f Mon Sep 17 00:00:00 2001 From: Matt Layman Date: Wed, 30 Mar 2022 09:49:27 -0400 Subject: [PATCH] Fix review comments. --- pre_commit/commands/autoupdate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py index 1fc464a2b..b4d559c8e 100644 --- a/pre_commit/commands/autoupdate.py +++ b/pre_commit/commands/autoupdate.py @@ -43,7 +43,7 @@ def get_best_candidate_tag(self, rev: str, git_repo: str) -> str: 'git', *git.NO_FS_MONITOR, 'tag', '--points-at', rev, cwd=git_repo, )[1].split() for tag in tags: - if '.' in tag and re.match(r'^[a-zA-Z0-9.]+$', tag): + if '.' in tag: return tag return rev @@ -70,7 +70,8 @@ def update(self, tags_only: bool, freeze: bool) -> RevInfo: try: rev = cmd_output(*tag_cmd, cwd=tmp)[1].strip() - rev = self.get_best_candidate_tag(rev, tmp) + if tags_only: + rev = self.get_best_candidate_tag(rev, tmp) except CalledProcessError: cmd = (*git_cmd, 'rev-parse', 'FETCH_HEAD') rev = cmd_output(*cmd, cwd=tmp)[1].strip()