diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-08 15:30:50 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-08 19:24:10 +0100 |
commit | d2cfebaad77a978ef2849cddc96740aef39c2d32 (patch) | |
tree | 0e8e2a923092f9a7e9c953f514837a74ae76f11a /dgit | |
parent | 7d64947564587518ec007066ac76e0373cb79da8 (diff) |
New import: Introduce make_commit_text (nfc)
No callers yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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'; |