Tanay Abhra
2014-10-02 13:24:47 UTC
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(-)
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(-)
--
1.9.0.GIT
1.9.0.GIT