Skip to content

config: allow disabling config includes

Derrick Stolee via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3git-config.adoc: fix paragraph breakDocumentation/git-config.adoc+1 -10 replies
2/3config: add GIT_CONFIG_INCLUDESDocumentation/git-config.adoc config.c environment.h +1 more+48 -13 replies
3/3git: add --no-includes top-level optionDocumentation/git.adoc git.c t/t1305-config-include.sh+16 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] config: allow disabling config includes

This series introduces a new way to ignore config include directives via two mechanisms:

* GIT_CONFIG_INCLUDES=0 in the environment.
* git --no-includes ... in the command line.

My motivation is from a tricky situation where users want to do the risky thing and include a repo-tracked file for sharing aliases and other recommended config. They are then struggling in a later build step that is running Git commands (under a tool we don't control and can't change) that then cause filesystem accesses outside of the build system's sandbox.

While git config has a --no-includes option, that doesn't impact the behavior of other Git commands. We build upon that existing logic for disabling includes, though.

Having had recent luck recommending GIT_ADVICE=0 when running Git commands from third-party tools, I thought that a similar environment variable to disable this functionality would be helpful, too.

One thing I do worry about is whether or not this would cause a significant break in behavior, or if this is a relatively safe thing to allow.

The three patches are organized as follows:

1. Patch 1 has a small typo fix in the config documentation that messes with the format of the bulleted list. I include it here because I add to that list in patch 2.
2. Patch 2 adds the environment variable and tests it via 'git config' and the use of a Git alias.
3. Patch 3 adds the '--no-includes' option at the top level.

Thanks, -Stolee

Derrick Stolee (3):
git-config.adoc: fix paragraph break
config: add GIT_CONFIG_INCLUDES
git: add --no-includes top-level option

 Documentation/git-config.adoc |  7 ++++++-
 Documentation/git.adoc        |  6 +++++-
 config.c                      |  7 ++++++-
 environment.h                 |  6 ++++++
 git.c                         |  6 +++++-
 t/t1305-config-include.sh     | 35 +++++++++++++++++++++++++++++++++++
 6 files changed, 63 insertions(+), 4 deletions(-)

base-commit: 9ac3f193c05c2237e2b14ebaa1149e9fc8a1abe0
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2139%2Fderrickstolee%2Fconfig-include-override-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2139/derrickstolee/config-include-override-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2139

Signature · 1 line
gitgitgadget