From 53c494f6bfc85d83914a9e7b3703f47d3fabfb7c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 24 Jan 2018 16:34:25 +0000 Subject: [PATCH] git-debrebase: break out read_tree_subdir (nfc) Signed-off-by: Ian Jackson --- git-debrebase | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git-debrebase b/git-debrebase index 47411acb..01595c45 100755 --- a/git-debrebase +++ b/git-debrebase @@ -257,6 +257,12 @@ sub rm_subdir_cached ($) { runcmd @git, qw(rm --quiet -rf --cached --ignore-unmatch), $subdir; } +sub read_tree_subdir ($$) { + my ($subdir, $new_tree_object) = @_; + rm_subdir_cached $subdir; + runcmd @git, qw(read-tree), "--prefix=$subdir/"; +} + # classify returns an info hash like this # CommitId => $objid # Hdr => # commit headers, including 1 final newline @@ -642,8 +648,7 @@ sub walk ($;$$) { my $read_tree_debian = sub { my ($treeish) = @_; - rm_subdir_cached qw(debian); - runcmd @git, qw(read-tree --prefix=debian/), "$treeish:debian"; + read_tree_subdir 'debian', "$treeish:debian"; }; my $read_tree_upstream = sub { my ($treeish) = @_; -- 2.30.2