d8df4a9344
(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
51 lines
1.2 KiB
Perl
Executable file
51 lines
1.2 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# update git-config entries in each repo
|
|
# ----------------------------------------------------------------------
|
|
|
|
use FindBin;
|
|
|
|
use lib $ENV{GL_LIBDIR};
|
|
use Gitolite::Rc;
|
|
use Gitolite::Common;
|
|
use Gitolite::Conf::Load;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $RB = $rc{GL_REPO_BASE};
|
|
_chdir($RB);
|
|
|
|
# ----------------------------------------------------------------------
|
|
# if called from POST_CREATE, we have only a single repo to worry about
|
|
if (@ARGV and $ARGV[0] eq 'POST_CREATE') {
|
|
my $repo = $ARGV[1];
|
|
fixup_config($repo);
|
|
|
|
exit 0;
|
|
}
|
|
|
|
# ----------------------------------------------------------------------
|
|
# else it's all repos (i.e., called from POST_COMPILE)
|
|
|
|
my $lpr = list_phy_repos();
|
|
|
|
for my $pr (@$lpr) {
|
|
fixup_config($pr);
|
|
}
|
|
|
|
sub fixup_config {
|
|
my $pr = shift;
|
|
|
|
my $gc = git_config( $pr, '.', 1 );
|
|
while ( my ( $key, $value ) = each( %{$gc} ) ) {
|
|
next if $key =~ /^gitolite-options\./;
|
|
if ( $value ne "" ) {
|
|
$value =~ s/%GL_REPO/$pr/g;
|
|
system( "git", "config", "--file", "$RB/$pr.git/config", $key, $value );
|
|
} else {
|
|
system( "git", "config", "--file", "$RB/$pr.git/config", "--unset-all", $key );
|
|
}
|
|
}
|
|
}
|