import_sorter icon indicating copy to clipboard operation
import_sorter copied to clipboard

Pre-commit now throws a warning when targeting a specific branch

Open ptrbrynt opened this issue 4 years ago • 5 comments

Describe the bug

When running pre-commit with this config:

repos:
  - repo: https://github.com/fluttercommunity/import_sorter
    rev: "master"
    hooks:
      - id: flutter-import-sorter

A warning is thrown:

[WARNING] The 'rev' field of repo 'https://github.com/fluttercommunity/import_sorter' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.

Expected behavior

I would like a tag to be added to GitHub which I can reference in my pre-commit config.

Meta Information:

  • Dart Version: 2.10.5
  • import_sorter Version: master
  • Is it a Flutter project? Yes
  • What version of Flutter are you using (if flutter project): 1.22.6

ptrbrynt avatar Feb 11 '21 10:02 ptrbrynt

👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible.

github-actions[bot] avatar Feb 11 '21 10:02 github-actions[bot]

@lig any idea why this might be going on?

gleich avatar Feb 11 '21 15:02 gleich

@Matt-Gleich I'll try to look into this a bit later

lig avatar Feb 11 '21 15:02 lig

So, according to pre-commit docs, this is by pre-commit design for mutable git references, aka branch references.

@Matt-Gleich Using tags in the import_sorter repo would be beneficial for pre-commit hooks as it will allow using tags instead of the master reference in pre-commit configs.

@ptrbrynt as a workaround, I recommend following pre-commit docs advice and use --bleeding-edge argument for pre-commit autoupdate, i.e.

pre-commit autoupdate --bleeding-edge --repo https://github.com/fluttercommunity/import_sorter

This should point the revision to the latest commit hash in master instead of referencing master by mutable named reference.

lig avatar Feb 12 '21 06:02 lig

See #63

gleich avatar Dec 07 '21 20:12 gleich