Commit Graph

86 Commits

Author SHA1 Message Date
taoufik07
60a42e9419 Remove GOPATH special build 2023-01-02 18:53:14 -05:00
marsha
4399c2dbc6 Add --no-ext-diff to git diff call 2022-11-10 20:09:56 -06:00
marsha
4bca29ee2c Change intent_to_add_files from using git status to git diff 2022-11-02 18:59:36 -05:00
marsha
84b38f7b89 Change cmd_output_bs retcode arg to a boolean check 2022-10-30 14:49:42 -05:00
Matt Phillips
8ebb7ae2f5 add GIT_ASKPASS as a passthrough env var
documented via man gitcredentials,  it is used to provide a script/input
for git to fetch creds in a no-tty usecase.
used among other things by jenkins to pass credentials down to git for
authentication.

1e3488a730/README.adoc (git-bindings)
9429e7d05d/src/main/java/jenkins/plugins/git/GitUsernamePasswordBinding.java (L130)
2022-10-27 15:55:31 -04:00
Anthony Sottile
bc96b0bcf6 fix tests for submodules for CVE-2022-39253 2022-10-22 09:34:43 -07:00
Daniel Schürmann
ba132f0200 Split get_git_dir() into get_git_dir() and get_git_common_dir()
This fixes the conflicted state check when using work trees. #1972
2022-04-02 15:07:22 -04:00
Matt Layman
e8b46c1b16 Pick a tag if multiple tags exist on a SHA.
Fixes #2311
2022-03-31 10:37:51 -04:00
VincentBerthier
07f441584b GIT_HTTP_PROXY_AUTHMETHOD kept in env variables 2022-03-04 20:18:27 +01: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
Marius Zwicker
4eb91cdd8e support gitconfig from env
Add exceptions to the git env so externally configured gitconfig
values set via GIT_CONFIG_KEY_<n>, GIT_CONFIG_VALUE_<n> and
GIT_CONFIG_COUNT get passed through.
2021-11-22 19:40:30 -05:00
Anthony Sottile
ab94dd69f8 fix pre-commit autoupdate for core.useBuiltinFSMonitor=true on windows 2021-09-13 20:01:25 -04:00
Anthony Sottile
0fe959df60 fall back to full diff on disparate histories 2021-08-09 20:13:15 -04:00
Anthony Sottile
f9fbe18abf Fix pre-commit install on subst drives 2021-02-23 18:52:24 -08:00
Anthony Sottile
f75fc6b2a8 fix execution in worktrees in subdirectories of bare repositories 2021-01-27 10:08:48 -08:00
Mark Rogaski
29d15de38e git: changed rev-parse option for Git 2.25 changes to --show-toplevel
Git 2.25 introduced a change to "rev-parse --show-toplevel" that exposed underlying volumes for Windows drives mapped with SUBST.  We use "rev-parse --show-cdup" to get the appropriate path, but must perform an extra check to see if we are in the .git directory.
2020-12-07 13:54:05 -08:00
Anthony Sottile
8cfe8e590d don't crash on cygwin mismatch check 2020-11-28 15:20:14 -08:00
Michael Vincent
120d60223a Improve performance by ignoring submodules
When git status runs in a repo with submodules, it'll recursively run
git status in every submodule as well by default (sequentially).
git status is substantially slower on Windows than on Linux. git diff
behaves similarly to git status in terms of running recursively within
all submodules. In repos with hundreds of submodules, this quickly adds
up when git status/diff are called multiple times. Pre-commit runs
git status once at the beginning of an operation and then runs git diff
before and after each hook. These calls quickly add up and make
pre-commit unusable in large repos with lots of submodules.

This commit drastically improves performance in repos with lots of
submodules and fixes #1701 by telling git status and git diff to ignore
submodules. This change is not expected to have any negative effect on
existing hooks because each submodule should manage its own hooks
instead of relying on superproject hooks to manipulate their contents.
2020-11-19 23:26:05 -06:00
Anthony Sottile
24dfeed89c Replace EnvironT with MutableMapping[str, str] 2020-10-28 13:00:25 -07:00
Anthony Sottile
91530f1005 check cygwin mismatch earlier 2020-09-20 10:42:11 -07:00
Anthony Sottile
6ee9e13b26 prevent infinite recursion of post-checkout on clone 2020-06-09 10:18:22 -07:00
Anthony Sottile
d35b00352f Make more readable --from-ref / --to-ref aliases for --source / --origin 2020-02-23 11:07:57 -08:00
Michael Schier
d9800ad95a exclude GIT_SSL_NO_VERIFY env variable from getting stripped 2020-01-21 15:17:03 -08:00
Anthony Sottile
df40e862f4 More miscellaneous cleanup 2020-01-13 11:47:34 -08:00
Anthony Sottile
9000e9dd41 Some manual .format() -> f-strings 2020-01-12 13:39:53 -08:00
Anthony Sottile
aefbe71765 Clean up calls to .encode() / .decode() 2020-01-12 10:46:33 -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
Anthony Sottile
968b2fdaf1 Allow try-repo to work on bare repositories 2019-12-30 11:00:45 -08:00
Ivan Gankevich
8c93896c48 Add GIT_SSL_CAINFO environment variable to whitelist.
This commit fixes #1253.
2019-12-26 12:43:55 +03:00
Anthony Sottile
f612aeb22b Split out cmd_output_b 2019-10-06 15:16:47 -07:00
Anthony Sottile
73250ff4e3 Fix autoupdate to always use non-shallow clone 2019-07-20 14:59:49 -07:00
Anthony Sottile
dc28922ccb Run pre-commit autoupdate
Committed via https://github.com/asottile/all-repos
2019-03-21 21:09:33 -07:00
DanielChabrowski
888787fb2d Fix try-repo for staged untracked changes 2019-03-18 02:04:50 +01:00
Brett Randall
f5af95cc9d Added test for git.no_git_env().
Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-03-18 10:23:54 +11:00
Min RK
9cde231665 respect GIT_EXEC_PATH env
This env may be required for git to work,
unsetting it can cause clone to fail

occurs with bundled git, e.g. Fork git client
2019-02-16 09:14:11 +01:00
Benjamin Bariteau
db04d612e0 pass GIT_SSH_COMMAND to git commands, refs #947 2019-02-15 14:37:53 -08:00
Anthony Sottile
e60579d9f3 Fix staged-files-only for git add --intent-to-add files 2019-01-08 09:28:57 -08:00
Anthony Sottile
bdc58cc33f Teach pre-commit try-repo to clone uncommitted changes 2019-01-01 15:01:36 -08:00
Anthony Sottile
fe409f1a43 Remove stateful Runner 2018-12-26 22:33:21 -08:00
Anthony Sottile
18b6f4b519 Fix rev-parse for older git versions 2018-09-22 11:12:27 -07:00
Mickaël Schoentgen
67d6fcb0f6 Fix several ResourceWarning: unclosed file 2018-08-10 18:30:22 +02:00
Anthony Sottile
3f78487769 Support pre-commit install inside a worktree 2018-08-06 09:26:42 -07:00
Anthony Sottile
5651c66995 Migrate sha -> rev 2018-02-24 20:19:39 -08:00
Anthony Sottile
2c88791a7f Add pre-commit try-repo
`try-repo` is useful for:
- Trying out a remote hook repository without needing to configure it.
- Testing a hook repository while developing it.
2017-10-07 18:03:52 -07:00
Anthony Sottile
18c9e061d8 Small cleanups 2017-09-30 15:53:44 -07:00
Anthony Sottile
6af60158ec Refactor filename collection for hooks 2017-09-09 22:07:27 -07:00
Anthony Sottile
0815108242 Handle non-ascii filenames from git 2017-09-05 08:10:16 -07:00
Anthony Sottile
0c70fa4229 Use asottile/add-trailing-comma 2017-07-12 18:30:51 -07:00
Anthony Sottile
321210d332 Run git diff with --no-ext-diff 2017-06-09 08:34:04 -07:00