X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=Debian%2FDgit.pm;h=3d97848ff2df75b96491a8fc2ac2d6bd5224a86a;hp=aef0112aebb975ce49cca55699808fbe6cf99922;hb=be85ba38f1d9099179b6b6cc7cafac769ccf11da;hpb=0b0c7e0ce2f0f17cacef7eb3159fc9de1850bf37 diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index aef0112a..3d97848f 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -58,6 +58,7 @@ BEGIN { $debugprefix *debuglevel *DEBUG shellquote printcmd messagequote $negate_harmful_gitattrs + git_slurp_config_src workarea_setup); # implicitly uses $main::us %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)] ); @@ -417,6 +418,30 @@ sub is_fast_fwd ($$) { } } +sub git_slurp_config_src ($) { + my ($src) = @_; + # returns $r such that $r->{KEY}[] = VALUE + my @cmd = (qw(git config -z --get-regexp), "--$src", qw(.*)); + debugcmd "|",@cmd; + + local ($debuglevel) = $debuglevel-2; + local $/="\0"; + + my $r = { }; + open GITS, "-|", @cmd or die $!; + while () { + chomp or die; + printdebug "=> ", (messagequote $_), "\n"; + m/\n/ or die "$_ ?"; + push @{ $r->{$`} }, $'; #'; + } + $!=0; $?=0; + close GITS + or ($!==0 && $?==256) + or failedcmd @cmd; + return $r; +} + sub workarea_setup ($) { # for use in the workarea my ($t_local_git_cfg) = @_;