Skip to content

pre-commit autoupdate updates rev to stable #1925

@jmknoble

Description

@jmknoble
$ pre-commit --version
pre-commit 2.13.0
$ grep -A 4 'repo:.*json-indent' .pre-commit-config.yaml
  - repo: https://github.com/jmknoble/json-indent
    rev: 2.4.1
    hooks:
      - id: json-indent

$ pre-commit autoupdate
...
Updating https://github.com/jmknoble/json-indent ... updating 2.4.1 -> stable.
...

Tags on json-indent:

$ git remote get-url origin
https://github.com/jmknoble/json-indent.git
$ git show -s FETCH_HEAD
commit d6c0785f4000355bb6fc5f788889ba99617d0d96 (HEAD -> main, tag: v2.4.4, tag: stable, origin/main, origin/HEAD)
Author: Jim Knoble <jmknoble@...>
Date:   Thu May 27 09:41:10 2021 -0700

    Update stable version to 2.4.4
$

This seems to be related to commands.autoupdate.RevInfo.update(), where git describe FETCH_HEAD --tags is used:

$ git --version
git version 2.31.1
$ git describe FETCH_HEAD --tags --abbrev=0
stable
$ git describe FETCH_HEAD --tags --exact
stable
$

If I use either --match or --exclude, I can get the tag we're after:

$ git describe FETCH_HEAD --tags --exact --match '*.*'
v2.4.4
$ git describe FETCH_HEAD --tags --exact --exclude stable
v2.4.4
$

Using --match '*.*' is closer to what is checked in clientlib.WarnMutableRev(), but fails the hex regex check. That may be ok, since git describe is looking for tags. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions