diff --git a/doc/git-config.mkd b/doc/git-config.mkd index e1c1c00..94487e1 100644 --- a/doc/git-config.mkd +++ b/doc/git-config.mkd @@ -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. > ---- diff --git a/src/lib/Gitolite/Conf/Load.pm b/src/lib/Gitolite/Conf/Load.pm index 8f1ebfe..9f4ddb0 100644 --- a/src/lib/Gitolite/Conf/Load.pm +++ b/src/lib/Gitolite/Conf/Load.pm @@ -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; } diff --git a/src/triggers/post-compile/update-git-configs b/src/triggers/post-compile/update-git-configs index 7f3fb83..bd7ff13 100755 --- a/src/triggers/post-compile/update-git-configs +++ b/src/triggers/post-compile/update-git-configs @@ -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 "" ) {