Skip to content

add "unset.variable" for unsetting previously set variables

Tanay Abhra git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5config.c : move configset_iter() to an appropriate positionconfig.c+19 -190 replies
2/5make git_config_with_options() to use a configsetconfig.c t/t1300-repo-config.sh+20 -30 replies
3/5add "unset.variable" for unsetting previously set variablesconfig.c+34 -00 replies
4/5document the new "unset.variable" variableDocumentation/config.txt+12 -00 replies
5/5add tests for checking the behaviour of "unset.variable"t/t1300-repo-config.sh+54 -013 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchMatthieu Moy
1/5Helped-by
2/5Helped-by
3/5Helped-by
4/5Helped-by
5/5Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH/RFC 0/5] add "unset.variable" for unsetting previously set variables

Hi,

This series aims to add a method to filter previously set variables. The patch series can be best described by the 3/5 log message which I have pasted below verbatim.

"
Add a new config variable "unset.variable" which unsets previously set variables. It affects git_config() and git_config_get_*() family of functions. It removes the matching variables from the configset which were added previously. Those matching variables which come after the "unset.variable" in parsing order will not be deleted and will be left untouched.

It affects the result of "git config -l" and similar calls. It may be used in cases where the user can not access the config files, for example, the system wide config files may be only accessible to the system administrator. We can unset an unwanted variable declared in the system config file by using "unset.variable" in a local config file.

for example, /etc/gitconfig may look like this,

	[foo]
		bar = baz

in the repo config file, we will write,

	[unset]
		variable  = foo.bar

to unset foo.bar previously declared in system wide config file. "

Now, I have some points of
contention which I like to clarify,

1> The name of the variable, I could not decide between "unset.variable" and "config.unset", or may be some other name would be more appropriate.

2> It affects both the C git_config() calls and, git config shell invocations. Due to this some variables may be absent from the git config -l result which might confuse the user.

3> I also have an another implementation for this series which just marks the config variables instead of deleting them from the configset. This can be used to provide two versions of git_config(), one with filtered variables other without it.

4> While hacking on this series, I saw that git_config_int() does not print the file name of the invalid variable when values are fed by the configset. I will correct this regression in another patch.

Cheers,
Tanay

 Documentation/config.txt | 12 +++++++
 config.c                 | 93 +++++++++++++++++++++++++++++++++++++-----------
 t/t1300-repo-config.sh   | 56 ++++++++++++++++++++++++++++-
 3 files changed, 139 insertions(+), 22 deletions(-)
Signature · 1 line
1.9.0.GIT