Skip to content

Commit

Permalink
Fix review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblayman committed Mar 30, 2022
1 parent 6745d15 commit db80394
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pre_commit/commands/autoupdate.py
Expand Up @@ -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

Expand All @@ -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()
Expand Down

0 comments on commit db80394

Please sign in to comment.