From: Ian Jackson Date: Sat, 8 Oct 2016 14:30:50 +0000 (+0100) Subject: New import: Introduce make_commit_text (nfc) X-Git-Tag: archive/debian/2.0~95 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=d2cfebaad77a978ef2849cddc96740aef39c2d32 New import: Introduce make_commit_text (nfc) No callers yet. Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index 5e852b60..b9b47eb3 100755 --- a/dgit +++ b/dgit @@ -1450,6 +1450,27 @@ sub make_commit ($) { return cmdoutput @git, qw(hash-object -w -t commit), $file; } +sub make_commit_text ($) { + my ($text) = @_; + my ($out, $in); + my @cmd = (@git, qw(hash-object -w -t commit --stdin)); + debugcmd "|",@cmd; + my $child = open2($out, $in, @cmd) or die $!; + my $h; + eval { + print $in $text or die $!; + close $in or die $!; + $h = <$out>; + $h =~ m/^\w+$/ or die; + $h = $&; + printdebug "=> $h\n"; + }; + close $out; + waitpid $child, 0 == $child or die "$child $!"; + $? and failedcmd @cmd; + return $h; +} + sub clogp_authline ($) { my ($clogp) = @_; my $author = getfield $clogp, 'Maintainer';