Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor GIT_CONFIG_PARAMETERS env var #495

Merged
merged 3 commits into from
Jan 8, 2021
Merged

Conversation

dandavison
Copy link
Owner

cc @wyuenho @ulwlu

When git is invoked as git -c aaa.bbb=ccc -c ddd.eee=fff then git
sets the env var GIT_CONFIG_PARAMETERS containing the changed config
entries, so that child processes can honor them.

libgit2 doesn't yet honor the env var: see
libgit2/libgit2#3854.

Fixes #493
Fixes #307
Ref dandavison/magit-delta#13

@dandavison dandavison force-pushed the 493-GIT_CONFIG_PARAMETERS branch from 3dad510 to 93cedd2 Compare January 8, 2021 14:52
@dandavison
Copy link
Owner Author

This allows us to do things like

git -c delta.line-numbers=false -c delta.max-line-distance=0.8 show

# note: while quotes around color hex codes are required in gitconfig, they can be omitted in the `git -c` context
git -c delta.plus-style='syntax "#aa0000"' show
git -c delta.plus-style='syntax #aa0000' show

Thanks @wyuenho for pointing out that this should be made possible; I think this now becomes the preferred method for changing delta config on-the-fly. I'll need to remember to update the README at the next release.

When git is invoked as `git -c aaa.bbb=ccc -c ddd.eee=fff` then git
sets the env var GIT_CONFIG_PARAMETERS containing the changed config
entries, so that child processes can honor them.

libgit2 doesn't yet honor the env var: see
libgit2/libgit2#3854.

Fixes #493
Fixes #307
Ref dandavison/magit-delta#13
@dandavison dandavison force-pushed the 493-GIT_CONFIG_PARAMETERS branch from 93cedd2 to dc26797 Compare January 8, 2021 15:34
@dandavison dandavison merged commit 3c245e6 into master Jan 8, 2021
@dandavison dandavison deleted the 493-GIT_CONFIG_PARAMETERS branch January 8, 2021 16:36
@wyuenho
Copy link

wyuenho commented Jan 8, 2021

Nice! Can't wait to test it out in the next release.

ruohola added a commit to ruohola/dotfiles that referenced this pull request Aug 16, 2022
The original commit (1c83331) that introduced `gyn` it correctly stated
that `git -c` does not work for Delta options, but nowadays it does:
dandavison/delta#495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Delta does not respect git -c 🐛 Can't disable line numbering from command line
2 participants