Commit graph

103 commits

Author SHA1 Message Date
Yuri D'Elia
1bf65b37c6 Use os.path.realpath() for path canonicalization
os.getcwd() returns the real path of the current working directory. In
a directory which has been symlinked this does not necessarily match the
same prefix of the current directory.

When os.getcwd() is cd-ed to relativize path names a few lines below
this results in paths which are relative to symlinked tree, not to the
real tree. This makes path rule matches fail.

Use os.path.realpath() when making paths absolute, so that relative
paths refer to the same tree as os.getcwd()
2021-10-02 19:17:35 +02: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
Anthony Sottile
91530f1005 check cygwin mismatch earlier 2020-09-20 10:42:11 -07:00
Anthony Sottile
68510596d3 warn on old list-style configuration 2020-07-25 13:04:54 -07:00
Greg Singer
1b435f1f1f add init-templatedir --no-allow-missing-config
Add a `--no-allow-missing-config` option to the `init-templatedir`
command. Enable configuration of a Git template that requires newly
cloned repos to have a `pre-commit` config.
2020-07-20 19:02:35 -07:00
ModischFabrications
26adf1d560 add support for post-commit 2020-04-27 10:55:22 -07:00
Anthony Sottile
1e0db9c2c8 Fix help description for --from-ref and --to-ref 2020-03-12 12:27:54 -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
Anthony Sottile
0bb8a8fabe Move test to install_uninstall test so environment variables apply 2020-01-16 13:02:20 -08:00
David Martinez Barreiro
57cc814b8b Push remote env var details 2020-01-16 12:35:04 -08:00
Anthony Sottile
df40e862f4 More miscellaneous cleanup 2020-01-13 11:47:34 -08:00
Anthony Sottile
67c2dcd90d Remove pre_commit.five 2020-01-12 13:39:53 -08:00
Anthony Sottile
327ed924a3 Add types to pre-commit 2020-01-12 10:15:01 -08:00
Anthony Sottile
30c1e8289f upgrade hooks, pyupgrade pre-commit 2020-01-12 09:27:04 -08:00
orcutt989
c7d938c2c4 corrected styling 2020-01-10 18:49:21 -05:00
orcutt989
2cf127f2d3 fix prog arg to return correct version 2020-01-10 18:43:13 -05:00
Anthony Sottile
ae97bb5068 Remove autoupdate --tags-only option 2020-01-05 14:04:41 -08:00
Anthony Sottile
8a3c740f9e Implement pre-commit autoupdate --freeze 2019-12-28 13:07:39 -08:00
Anthony Sottile
c699e255a1 support pre-merge-commit 2019-12-26 21:21:00 -08:00
Anthony Sottile
2bdbd9e7a0 Fix for newest git 2019-12-06 09:27:19 -08:00
Anthony Sottile
0760bec3ff Show better error message when running inside .git 2019-11-18 14:57:41 -08:00
Anthony Sottile
36609ee305 Fix hook_types when calling init-templatedir 2019-09-30 10:29:53 -07:00
Anthony Sottile
a18646deb2 Allow --hook-type to be specified multiple times 2019-09-23 11:14:36 -07:00
Anthony Sottile
da80cc6479 Allow init-templatedir to be called outside of git 2019-08-03 11:41:54 -07:00
Edgar Geier
aaa249bda9 Overwrite default value of --color argument with PRE_COMMIT_COLOR env var 2019-07-23 17:42:28 +02:00
Anthony Sottile
9a52eefc99 Implement pre-commit init-templatedir 2019-07-20 20:33:42 -07:00
Anthony Sottile
3def940574 reorder pre-commit sub commands 2019-07-20 16:28:35 -07:00
Marc Jay
e60f541559 Adds support for prepare-commit-msg hooks
Adds a prepare-commit-msg hook stage which allows for hooks which add
dynamic suggested/placeholder text to commit messages that an author can
use as a starting point for writing a commit message
2019-04-21 21:07:13 +01:00
Anthony Sottile
917586a0e0 Don't require git for clean, gc, sample-config 2019-03-02 19:01:05 -08:00
Anthony Sottile
9e34e6e316 pre-commit gc 2019-01-02 19:07:23 -08:00
Anthony Sottile
e4f0b4c1b7 Only configure logging inside the context 2019-01-01 15:01:37 -08:00
Anthony Sottile
bdc58cc33f Teach pre-commit try-repo to clone uncommitted changes 2019-01-01 15:01:36 -08:00
Anthony Sottile
4da461d90a Fix try-repo relpath while in a sub-directory 2019-01-01 11:57:06 -08:00
Anthony Sottile
fe409f1a43 Remove stateful Runner 2018-12-26 22:33:21 -08:00
Anthony Sottile
c01ffc83f8 Separate store from runner 2018-06-29 22:35:53 -07:00
Anthony Sottile
6d683a5fac clean: separate store from runner 2018-06-29 20:08:23 -07:00
Anthony Sottile
0e430be0ce autoupdate: separate store from runner 2018-06-29 20:04:16 -07:00
Anthony Sottile
cd8179a974 Apply relative files to try-repo also 2018-05-12 10:01:14 -07:00
Anthony Sottile
bf5792eb10 Add a manual stage for cli-only interaction 2018-03-07 12:41:25 -08:00
Anthony Sottile
5651c66995 Migrate sha -> rev 2018-02-24 20:19:39 -08:00
Anthony Sottile
f76d3c4f95 Allow autoupdate --repo to be specified multiple times 2018-02-24 15:42:26 -08:00
Anthony Sottile
5a4dc0ce30 https-ify links
- A lot of http links loaded fine on https
- pre-commit.com is now loadable on https via cloudflare
2018-01-13 18:17:54 -08:00
Iulian Onofrei
8407b92b18 Replace string literals with constants 2018-01-09 17:51:41 +02:00
Anthony Sottile
fccb4e6935 Minor fixes 2017-11-06 18:14:59 -08:00
Kevin Hock
4d0c400066 Add repo option to autoupdate 2017-11-06 17:19:06 -08:00