chiark / gitweb /
git-debrebase: walk: Reintroduce the local $read_tree_upstream sub
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 13:57:47 +0000 (14:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 14:36:23 +0000 (15:36 +0100)
Now that we have the $tree_with_debian parameter to the global
read_tree_upstream, we can use it to avoid the git-write-tree call
and pass $build as the $tree_with_debian.

This thus partially reverts
  dfc092e0ec3d932e51a071000519477d0e33525c
  git-debrebase: Make read_tree_upstream global (nfc)

The combined effect is now that $read_tree_upstream does exactly the
git commands it did before.

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

index 60ea976..c8ee5e5 100755 (executable)
@@ -1276,6 +1276,11 @@ sub walk ($;$$$) {
 
     my $rewriting = 0;
 
+    my $read_tree_upstream = sub {
+       my ($treeish) = @_;
+       read_tree_upstream $treeish, 0, $build;
+    };
+
     $#upp_cl = $upp_limit if defined $upp_limit;
  
     my $committer_authline = calculate_committer_authline();
@@ -1303,7 +1308,7 @@ sub walk ($;$$$) {
            if ($method eq 'Debian') {
                read_tree_debian($cltree);
            } elsif ($method eq 'Upstream') {
-               read_tree_upstream($cltree);
+               $read_tree_upstream->($cltree);
            } elsif ($method eq 'StartRewrite') {
                $rewriting = 1;
                next;
@@ -1316,13 +1321,13 @@ sub walk ($;$$$) {
                confess unless $rewriting;
                my $differs = (get_differs $build, $cltree);
                next unless $differs & D_UPS;
-               read_tree_upstream($cltree);
+               $read_tree_upstream->($cltree);
                push @parents, map { $_->{CommitId} } @{ $cl->{OrigParents} };
            } elsif ($method eq 'MergeCreateMergedBreakwaters') {
                print "Found a general merge, will try to tidy it up.\n";
                $rewriting = 1;
-               read_tree_upstream($cl->{MergeBestAnchor});
-               read_tree_upstream($cl->{MergeBestAnchor});
+               $read_tree_upstream->($cl->{MergeBestAnchor});
+               $read_tree_upstream->($cl->{MergeBestAnchor});
                read_tree_debian($cltree);
                @parents = map { $_->{Breakwater} } @{ $cl->{Parents} };
            } elsif ($method eq 'MergeMergeSeries') {