Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pre_commit/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def _shallow_clone(self, ref: str, git_cmd: Callable[..., None]) -> None:
git_config = 'protocol.version=2'
git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
git_cmd('checkout', 'FETCH_HEAD')
git_cmd('tag', '-a', '-m', '""', ref, 'FETCH_HEAD')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is good either. this will tag non-tags (and invoke signing mechanisms)

Copy link
Copy Markdown
Author

@gnought gnought Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will tag non-tag revisions but limit to local. As long as pre-commit does not push changes, this will not affect the remote or introduce signing issues.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-m invokes signing. and if this tags things differently than the actual repo that's not ok

Copy link
Copy Markdown
Author

@gnought gnought Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that -m does not trigger signing unless -s is used.

git does not provide a direct way to fetch a specific tag at a particular commit. The only single-command option is to use --tags with git fetch, but that would retrieve all tags and be slower than creating a fake local tag.

What do you think about the 3rd proposal on git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1', '--tags') ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your understanding is slightly wrong. and no --tags will not work that will fetch a bunch of unnecessary stuff

git_cmd(
'-c', git_config, 'submodule', 'update', '--init', '--recursive',
'--depth=1',
Expand Down
Loading