diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-07-14 10:53:33 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-07-19 00:28:01 +0100 |
commit | be85ba38f1d9099179b6b6cc7cafac769ccf11da (patch) | |
tree | a97e4e402433764e212e49c87d59d2058a64b3ba /dgit | |
parent | 0b0c7e0ce2f0f17cacef7eb3159fc9de1850bf37 (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 'dgit')
-rwxr-xr-x | dgit | 18 |
1 files changed, 1 insertions, 17 deletions
@@ -641,30 +641,14 @@ our %gitcfgs; our @gitcfgsources = qw(cmdline local global system); sub git_slurp_config () { - local ($debuglevel) = $debuglevel-2; - local $/="\0"; - # This algoritm is a bit subtle, but this is needed so that for # options which we want to be single-valued, we allow the # different config sources to override properly. See #835858. foreach my $src (@gitcfgsources) { next if $src eq 'cmdline'; # we do this ourselves since git doesn't handle it - - my @cmd = (@git, qw(config -z --get-regexp), "--$src", qw(.*)); - debugcmd "|",@cmd; - open GITS, "-|", @cmd or die $!; - while (<GITS>) { - chomp or die; - printdebug "=> ", (messagequote $_), "\n"; - m/\n/ or die "$_ ?"; - push @{ $gitcfgs{$src}{$`} }, $'; #'; - } - $!=0; $?=0; - close GITS - or ($!==0 && $?==256) - or failedcmd @cmd; + $gitcfgs{$src} = git_slurp_config_src $src; } } |