summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-07-14 10:53:33 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-07-19 00:28:01 +0100
commitbe85ba38f1d9099179b6b6cc7cafac769ccf11da (patch)
treea97e4e402433764e212e49c87d59d2058a64b3ba /Debian
parent0b0c7e0ce2f0f17cacef7eb3159fc9de1850bf37 (diff)
Dgit.pm: git_slurp_config_src: Break out from dgit
We are going to want this so we can provide better subtree setup functions in Dgit.pm, including the config transfer. No functional change, except that we now run just "git" from the path, rather than honouring dgit's @git (which is not available in Dgit.pm). Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Dgit.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index aef0112..3d97848 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 (<GITS>) {
+ 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) = @_;