chiark / gitweb /
git-debrebase: break out read_tree_subdir (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 24 Jan 2018 16:34:25 +0000 (16:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 11:25:49 +0000 (12:25 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 47411acb13e262f3fd0db89ca5dbf2cf336fd08c..01595c45a116b333eb0cd4af55f66c5da4dc60c4 100755 (executable)
@@ -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) = @_;