chiark / gitweb /
git-debrebase: Make read_tree_debian global (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2018 11:54:49 +0000 (12:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2018 13:16:33 +0000 (14:16 +0100)
We can't easily do this to read_tree_upstream because that needs to
put debian/ back which is awkward.

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

index f56ec32..1a79a28 100755 (executable)
@@ -255,6 +255,12 @@ sub read_tree_subdir ($$) {
     runcmd @git, qw(read-tree), "--prefix=$subdir/", $new_tree_object;
 }
 
+sub read_tree_debian ($) {
+    my ($treeish) = @_;
+    read_tree_subdir 'debian', "$treeish:debian";
+    rm_subdir_cached 'debian/patches';
+}
+
 sub make_commit ($$) {
     my ($parents, $message_paras) = @_;
     my $tree = cmdoutput @git, qw(write-tree);
@@ -867,15 +873,10 @@ sub walk ($;$$$) {
 
     my $rewriting = 0;
 
-    my $read_tree_debian = sub {
-       my ($treeish) = @_;
-       read_tree_subdir 'debian', "$treeish:debian";
-        rm_subdir_cached 'debian/patches';
-    };
     my $read_tree_upstream = sub {
        my ($treeish) = @_;
        runcmd @git, qw(read-tree), $treeish;
-       $read_tree_debian->($build);
+       read_tree_debian($build);
     };
 
     $#upp_cl = $upp_limit if defined $upp_limit;
@@ -903,7 +904,7 @@ sub walk ($;$$$) {
            printdebug "WALK BUILD ".($cltree//'undef').
                " $method (rewriting=$rewriting)\n";
            if ($method eq 'Debian') {
-               $read_tree_debian->($cltree);
+               read_tree_debian($cltree);
            } elsif ($method eq 'Upstream') {
                $read_tree_upstream->($cltree);
            } elsif ($method eq 'StartRewrite') {
@@ -913,7 +914,7 @@ sub walk ($;$$$) {
                $breakwater = $build;
                next;
            } elsif ($method eq 'DgitImportDebianUpdate') {
-               $read_tree_debian->($cltree);
+               read_tree_debian($cltree);
            } elsif ($method eq 'DgitImportUpstreamUpdate') {
                confess unless $rewriting;
                my $differs = (get_differs $build, $cltree);