chiark / gitweb /
git-debrebase: read_tree_upstream: New $tree_with_debian parameter
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 12:20:03 +0000 (13:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 14:03:51 +0000 (15:03 +0100)
If not passed, this function does the same as it did before.

NFC.

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

index ef619be..4f9a9bb 100755 (executable)
@@ -263,11 +263,15 @@ sub read_tree_debian ($) {
     rm_subdir_cached 'debian/patches';
 }
 
     rm_subdir_cached 'debian/patches';
 }
 
-sub read_tree_upstream ($;$) {
-    my ($treeish, $keep_patches) = @_;
-    my $save = cmdoutput @git, qw(write-tree --prefix=debian/);
+sub read_tree_upstream ($;$$) {
+    my ($treeish, $keep_patches, $tree_with_debian) = @_;
+    # if $tree_with_debian is supplied, will use that for debian/
+    # otherwise will save and restore it.
+    my $debian =
+       $tree_with_debian ? "$tree_with_debian:debian"
+       : cmdoutput @git, qw(write-tree --prefix=debian/);
     runcmd @git, qw(read-tree), $treeish;
     runcmd @git, qw(read-tree), $treeish;
-    read_tree_subdir 'debian', $save;
+    read_tree_subdir 'debian', $debian;
     rm_subdir_cached 'debian/patches' unless $keep_patches;
 };
 
     rm_subdir_cached 'debian/patches' unless $keep_patches;
 };