chiark / gitweb /
test suite: tagupl-native: Drop obsolete todo comment
[dgit.git] / Debian / Dgit.pm
index d60de77b6dc0790cdaf10cfb0377e94649c06198..348f608c5b5f3087d4e49bf44375c139e911d75b 100644 (file)
@@ -64,7 +64,7 @@ BEGIN {
                      read_tree_debian read_tree_upstream
                      make_commit hash_commit hash_commit_text
                      reflog_cache_insert reflog_cache_lookup
-                      $package_re $component_re $deliberately_re
+                      $package_re $component_re $suite_re $deliberately_re
                      $distro_re $versiontag_re $series_filename_re
                      $orig_f_comp_re $orig_f_sig_re $orig_f_tail_re
                      $extra_orig_namepart_re
@@ -96,6 +96,7 @@ our @EXPORT_OK;
 
 our $package_re = '[0-9a-z][-+.0-9a-z]*';
 our $component_re = '[0-9a-zA-Z][-+.0-9a-zA-Z]*';
+our $suite_re = '[-+.0-9a-z]+';
 our $deliberately_re = "(?:TEST-)?$package_re";
 our $distro_re = $component_re;
 our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+};
@@ -689,8 +690,11 @@ sub rm_subdir_cached ($) {
 
 sub read_tree_subdir ($$) {
     my ($subdir, $new_tree_object) = @_;
+    # If $new_tree_object is '', the subtree is deleted.
+    confess unless defined $new_tree_object;
     rm_subdir_cached $subdir;
-    runcmd qw(git read-tree), "--prefix=$subdir/", $new_tree_object;
+    runcmd qw(git read-tree), "--prefix=$subdir/", $new_tree_object
+       if length $new_tree_object;
 }
 
 sub read_tree_debian ($) {
@@ -702,9 +706,10 @@ sub read_tree_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.
+    # otherwise will save and restore it.  If $tree_with_debian
+    # is '' then debian/ is deleted.
     my $debian =
-       $tree_with_debian ? "$tree_with_debian:debian"
+       defined $tree_with_debian ? "$tree_with_debian:debian"
        : cmdoutput qw(git write-tree --prefix=debian/);
     runcmd qw(git read-tree), $treeish;
     read_tree_subdir 'debian', $debian;