'gitolite git-config' should print only value when regex not used...
not repo<tab>key<tab>value. Also, honor '-n' (no newline)
This commit is contained in:
parent
39fc5b32bb
commit
48f1e7c781
|
@ -23,8 +23,7 @@ Examples:
|
||||||
gitolite git-config -q repo gitweb.owner
|
gitolite git-config -q repo gitweb.owner
|
||||||
gitolite git-config -r repo gitweb
|
gitolite git-config -r repo gitweb
|
||||||
|
|
||||||
When the key is treated as a pattern, prints one key+value per line, tab
|
When the key is treated as a pattern, prints:
|
||||||
separated:
|
|
||||||
|
|
||||||
reponame<tab>key<tab>value<newline>
|
reponame<tab>key<tab>value<newline>
|
||||||
|
|
||||||
|
@ -57,10 +56,17 @@ if ( $repo ne '%' and $key ne '%' ) {
|
||||||
|
|
||||||
$ret = git_config( $repo, $key );
|
$ret = git_config( $repo, $key );
|
||||||
|
|
||||||
|
# if the key is not a regex, it should match at most one item
|
||||||
|
_die "found more than one entry for '$key'" if not $regex and scalar( keys %$ret ) > 1;
|
||||||
|
|
||||||
# unlike access, there's nothing to print if we don't find any matching keys
|
# unlike access, there's nothing to print if we don't find any matching keys
|
||||||
exit 1 unless %$ret;
|
exit 1 unless %$ret;
|
||||||
|
|
||||||
|
if ($regex) {
|
||||||
map { print "$repo\t$_\t" . $ret->{$_} . "\n" } sort keys %$ret unless $quiet;
|
map { print "$repo\t$_\t" . $ret->{$_} . "\n" } sort keys %$ret unless $quiet;
|
||||||
|
} else {
|
||||||
|
map { print $ret->{$_} . ( $nonl ? "" : "\n" ) } sort keys %$ret unless $quiet;
|
||||||
|
}
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue