From: Ian Jackson Date: Fri, 24 Aug 2018 23:57:59 +0000 (+0100) Subject: dgit: Introduce get_tree_of_commit X-Git-Tag: archive/debian/6.10~57 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=683ef14506d9907dfa102b5e228637415c4922b6;p=dgit.git dgit: Introduce get_tree_of_commit NFC Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index 0374b472..3438f62f 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