Commit graph

17 commits

Author SHA1 Message Date
Claude
66d1c0707e
perf: use git cat-file -e instead of git rev-list in _rev_exists
Replace git rev-list --quiet with git cat-file -e for checking if a
revision exists. This changes the operation from O(commits) to O(1).

Benchmarks from a large monorepo:
- git rev-list --quiet <sha>: 5150ms
- git cat-file -e <sha>: 4ms

Both commands have the same semantics: return success if the revision
exists in the local repo, failure otherwise.
2025-12-24 21:07:52 +00:00
JulianMaurin
c78f248c60 Add fail-fast argument for run command 2025-09-06 14:14:23 -04:00
Anthony Sottile
7f15dc75ee python3.9+ 2023-10-28 14:20:37 -04:00
Marcelo Galigniana
f39154f69f Add pre-rebase hook support 2023-03-11 15:17:42 -05:00
Anthony Sottile
e3e17a1617 make --hook-type and stages match 2023-03-11 14:26:14 -05:00
Matt Whitaker
702ebf402c Expose prepare-commit-msg arguments as environment vars 2022-06-11 14:25:55 -04:00
Wade Carpenter
feb0d34213
pre-push: fix stdin line splitting when <local ref> has whitespace
From the `pre-push.sample` file:

> Information about the commits which are being pushed is supplied as
> lines to the standard input in the form:
>
>   <local ref> <local sha1> <remote ref> <remote sha1>

When `<local ref>` is not simply a branch name, but a more general
ref (see git-rev-parse(1)), it could contain whitespace, and that
breaks the split() call that expected only 3 spaces in the line.

Changed to use `rsplit(maxsplit=3)` since only the <local ref> is
likely to have embedded whitespace.

Added a new test case for the same.
2022-04-14 14:27:46 -07:00
Anthony Sottile
04de6a2e57 drop python 3.6 support
python 3.6 reached end of life on 2021-12-23
2022-01-18 18:44:20 -05:00
Jordan Speicher
4cd8b364dd Add: post-rewrite hook support 2021-09-01 14:50:59 -05:00
Florent Clarret
584fd585ec Expose local branch ref as an environment variable 2021-06-19 18:18:14 +02:00
Paweł Sacawa
6b73138c73 Add: post-merge hook support 2021-02-23 19:00:02 -08:00
surafelabebe
cb5ed6276d Expose remote branch ref as an environment variable 2021-01-22 13:18:25 -08:00
ModischFabrications
26adf1d560 add support for post-commit 2020-04-27 10:55:22 -07:00
Anthony Sottile
80a59db094 validate argument length as part of hook-impl 2020-04-15 12:30:44 -07:00
Anthony Sottile
d35b00352f Make more readable --from-ref / --to-ref aliases for --source / --origin 2020-02-23 11:07:57 -08:00
Andrew Hare
18fa004254 Add post-checkout 2020-02-23 10:22:18 -08:00
Anthony Sottile
95b8d71bd9 Move most of the actual hook script into pre-commit hook-impl 2020-01-21 16:41:22 -08:00