From cfbec7a706fd1f631ebbed0c545980590eb26656 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 11 Aug 2018 13:20:03 +0100 Subject: [PATCH] git-debrebase: read_tree_upstream: New $tree_with_debian parameter If not passed, this function does the same as it did before. NFC. Signed-off-by: Ian Jackson --- git-debrebase | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/git-debrebase b/git-debrebase index ef619be4..4f9a9bb9 100755 --- a/git-debrebase +++ b/git-debrebase @@ -263,11 +263,15 @@ sub read_tree_debian ($) { 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; - read_tree_subdir 'debian', $save; + read_tree_subdir 'debian', $debian; rm_subdir_cached 'debian/patches' unless $keep_patches; }; -- 2.30.2