From 683ef14506d9907dfa102b5e228637415c4922b6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Aug 2018 00:57:59 +0100 Subject: dgit: Introduce get_tree_of_commit NFC Signed-off-by: Ian Jackson --- dgit | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 0374b47..3438f62 100755 --- a/dgit +++ b/dgit @@ -289,6 +289,14 @@ sub bpd_abs () { return $r; } +sub get_tree_of_commit ($) { + my ($commitish) = @_; + my $cdata = cmdoutput @git, qw(cat-file commit), $commitish; + $cdata =~ m/\n\n/; $cdata = $`; + $cdata =~ m/^tree (\w+)$/m or confess "cdata $cdata ?"; + return $1; +} + sub branch_gdr_info ($$) { my ($symref, $head) = @_; my ($status, $msg, $current, $ffq_prev, $gdrlast) = @@ -3164,10 +3172,7 @@ END # here we go, then: my $tree_commit = $mergeinputs[0]{Commit}; - my $tree = cmdoutput @git, qw(cat-file commit), $tree_commit; - $tree =~ m/\n\n/; $tree = $`; - $tree =~ m/^tree (\w+)$/m or die "$dsc_hash tree ?"; - $tree = $1; + my $tree = get_tree_of_commit $tree_commit;; # We use the changelog author of the package in question the # author of this pseudo-merge. This is (roughly) correct if -- cgit v1.2.3