GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — use git cat-file -e instead of git rev-list in _rev_exists by ptarjan · Pull Request #3605 · pre-commit/pre-commit

Conversation

@ptarjan

@ptarjan ptarjan commented Dec 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

fixes #3604

https://git-scm.com/docs/git-cat-file

-e
Exit with zero status if <object> exists and is a valid object. If <object> is of an invalid format, exit with non-zero status and emit an error on stderr.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ptarjan
use git cat-file -e instead of git rev-list in _rev_exists
b285ccc
fixes pre-commit#3604
asottile
asottile requested changes Dec 26, 2025
View reviewed changes

@asottile asottile left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

this causes output spew on missing / invalid revisions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pre_commit/commands/hook_impl.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan

ptarjan commented Dec 26, 2025

Copy link
Copy Markdown
Author

How is that different than the current implementation?

~/github/pre-commit rev-list $ git rev-list --quiet abcde --
fatal: bad revision 'abcde'
~/github/pre-commit rev-list $ git cat-file -e abcde
fatal: Not a valid object name abcde
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ptarjan added 2 commits December 26, 2025 15:09
@ptarjan
remove == 0
5a4235c
@ptarjan
Revert "remove == 0"
a26fb3b
This reverts commit 5a4235c.
@ptarjan
ptarjan requested a review from asottile December 26, 2025 22:11
ptarjan added 3 commits December 26, 2025 15:15
@ptarjan
redirect stderr to devnull
ed0d44b
@ptarjan
line length
7b1d351
@ptarjan
convert to not not
ade6b69
asottile
asottile reviewed Dec 26, 2025
View reviewed changes
Comment thread pre_commit/commands/hook_impl.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

ptarjan and others added 4 commits December 26, 2025 15:30
@ptarjan
maybe parens?
2b39c90
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
07ad091
for more information, see https://pre-commit.ci
@ptarjan
use bool
aec2057
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
58cbea1
for more information, see https://pre-commit.ci
asottile
asottile reviewed Dec 26, 2025
View reviewed changes
Comment thread pre_commit/commands/hook_impl.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan

ptarjan commented Dec 26, 2025 via email

Copy link
Copy Markdown
Author
I mean I liked the == 0 since the docs explicitly talk about retuning 0 when the SHA exists but this is your project and I just want the functionality. I’ll switch back to not
…
On Fri, Dec 26, 2025 at 12:41 PM anthony sottile ***@***.***> wrote: ***@***.**** commented on this pull request. ------------------------------ In pre_commit/commands/hook_impl.py <#3605 (comment)> : > - return not subprocess.call(('git', 'rev-list', '--quiet', rev)) + return not bool( + subprocess.call( + ('git', 'cat-file', '-e', rev), + stderr=subprocess.DEVNULL, + ), + ) not bool(...) is the same as not ... which you'll notice is *exactly what the original code does* — Reply to this email directly, view it on GitHub <#3605 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAJZT6M52IG7ENARCRZII34DW2QTAVCNFSM6AAAAACQCVVVUOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMJTHEZTAOBQHE> . You are receiving this because you authored the thread.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@asottile

asottile commented Dec 26, 2025

Copy link
Copy Markdown
Member

do you actually understand what not 0 does? I'm more and more convinced you're just regurgitating llm nonsense and wasting my time. a human would have just changed the command and called it a day but instead we're somehow 10 commits deep

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan
remove bool
3203dd3
@asottile

asottile commented Dec 27, 2025

Copy link
Copy Markdown
Member

How is that different than the current implementation?

~/github/pre-commit rev-list $ git rev-list --quiet abcde --
fatal: bad revision 'abcde'
~/github/pre-commit rev-list $ git cat-file -e abcde
fatal: Not a valid object name abcde

You're absolutely right!

akx reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan
ptarjan requested a review from asottile December 27, 2025 06:27
@ptarjan

ptarjan commented Dec 29, 2025

Copy link
Copy Markdown
Author

Is there anything else on this PR you need from me?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan

ptarjan commented Jan 25, 2026

Copy link
Copy Markdown
Author

Is there anything else on this PR you need from me?

Would you prefer anything else from me to get this merged?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rmawatson

rmawatson commented Feb 9, 2026

Copy link
Copy Markdown

@ptarjan - just to be understand, why was the PR here abandoned in favour of this one?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ptarjan

ptarjan commented Feb 12, 2026

Copy link
Copy Markdown
Author

@asottile didn't want a PR generated by Claude to be included in his repo so I generated this one by hand

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@asottile asottile mentioned this pull request Jul 21, 2026
faster check of rev existing locally as a commit #3726
Merged
@asottile asottile closed this in #3726 Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@asottile asottile Awaiting requested review from asottile

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

git rev-list --quiet is slow in a large repo

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ptarjan @asottile @rmawatson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.