chiark / gitweb /
git-debrebase: Make read_tree_upstream global (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2018 13:28:50 +0000 (14:28 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2018 13:32:35 +0000 (14:32 +0100)
Save debian/ explicitly.  This is a bit annoying.

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

index 1a79a28..f4602d5 100755 (executable)
@@ -261,6 +261,14 @@ sub read_tree_debian ($) {
     rm_subdir_cached 'debian/patches';
 }
 
+sub read_tree_upstream ($) {
+    my ($treeish) = @_;
+    my $save = cmdoutput @git, qw(write-tree --prefix=debian/);
+    runcmd @git, qw(read-tree), $treeish;
+    read_tree_subdir 'debian', $save;
+    rm_subdir_cached 'debian/patches';
+};
+
 sub make_commit ($$) {
     my ($parents, $message_paras) = @_;
     my $tree = cmdoutput @git, qw(write-tree);
@@ -873,12 +881,6 @@ sub walk ($;$$$) {
 
     my $rewriting = 0;
 
-    my $read_tree_upstream = sub {
-       my ($treeish) = @_;
-       runcmd @git, qw(read-tree), $treeish;
-       read_tree_debian($build);
-    };
-
     $#upp_cl = $upp_limit if defined $upp_limit;
  
     my $committer_authline = calculate_committer_authline();
@@ -906,7 +908,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;
@@ -919,7 +921,7 @@ 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} };
            } else {
                confess "$method ?";