chiark / gitweb /
dgit: Introduce get_tree_of_commit
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 24 Aug 2018 23:57:59 +0000 (00:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 10:59:55 +0000 (11:59 +0100)
NFC

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 0374b472504551f6d86f51f1537289ef8c43e4a1..3438f62f2b69a56d30fb5533bfc4cd25e583b6c2 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -289,6 +289,14 @@ sub bpd_abs () {
     return $r;
 }
 
     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) =
 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};
 
        # 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
 
        # We use the changelog author of the package in question the
        # author of this pseudo-merge.  This is (roughly) correct if