git-config bugfix + backward compat breakage in usage of 'config'
(1) the backward compat breakage: you can't create empty-valued config
keys anymore. That is, you can't do the eqvt of the following shell
command using gitolite
git config foo.bar ""
(2) fixed a bug where this:
repo foo
config foo.bar =
when queried using
gitolite git-config -r foo .
would return even the empty valued ones, which -- remember! -- are
not supposed to exist anymore.
Fixing this bug allows situations like this to not show the admin
repo in gitweb:
repo [a-z].*
config gitweb.owner = P-h B
repo gitolite-admin
config gitweb.owner =
----
background...
Somewhere in g3 (well actually in 057506b
), we lost the ability to
distinguish
config foo.bar = ""
from
config foo.bar =
I decided that conflating them is more intuitive for most people,
because a survey [1] revealed that no one seemed to want the equivalent
of the following shell command:
----
[1] ...of a (small prime greater than 1) number of people on #git
This commit is contained in:
parent
47a0c44540
commit
d8df4a9344
|
@ -23,9 +23,9 @@ For example:
|
|||
config foo.bar = ""
|
||||
config foo.baz =
|
||||
|
||||
This does either a plain "git config section.key value" (for the first 3
|
||||
examples above) or "git config --unset-all section.key" (for the last
|
||||
example). Other forms of the `git config` command (`--add`, the
|
||||
This does either a plain "git config section.key value" (for the first 2
|
||||
examples above) or "git config --unset-all section.key" (for the last 2
|
||||
examples). Other forms of the `git config` command (`--add`, the
|
||||
`value_regex`, etc) are not supported.
|
||||
|
||||
> ----
|
||||
|
|
|
@ -114,7 +114,7 @@ sub access {
|
|||
}
|
||||
|
||||
sub git_config {
|
||||
my ( $repo, $key ) = @_;
|
||||
my ( $repo, $key, $empty_values_OK ) = @_;
|
||||
$key ||= '.';
|
||||
|
||||
return {} if repo_missing($repo);
|
||||
|
@ -149,6 +149,15 @@ sub git_config {
|
|||
# and the final map does this:
|
||||
# 'foo.bar'=>'repo' , 'foodbar'=>'repoD'
|
||||
|
||||
# now some of these will have an empty key; we need to delete them unless
|
||||
# we're told empty values are OK
|
||||
unless ($empty_values_OK) {
|
||||
my($k, $v);
|
||||
while (($k, $v) = each %ret) {
|
||||
delete $ret{$k} if not $v;
|
||||
}
|
||||
}
|
||||
|
||||
trace( 3, map { ( "$_" => "-> $ret{$_}" ) } ( sort keys %ret ) );
|
||||
return \%ret;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ for my $pr (@$lpr) {
|
|||
sub fixup_config {
|
||||
my $pr = shift;
|
||||
|
||||
my $gc = git_config( $pr, '.' );
|
||||
my $gc = git_config( $pr, '.', 1 );
|
||||
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
||||
next if $key =~ /^gitolite-options\./;
|
||||
if ( $value ne "" ) {
|
||||
|
|
Loading…
Reference in a new issue