chiark / gitweb /
When source package contains things called .git (even files, and even in subdirectori...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Jul 2015 14:21:04 +0000 (15:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Jul 2015 14:27:02 +0000 (15:27 +0100)
debian/changelog
dgit

index c3e0a991a86b10057cefe5c4cb658968f4c4083a..166414377353eba0b5f1a18d00baee69469c5c39 100644 (file)
@@ -31,6 +31,8 @@ dgit (1.1) unstable; urgency=low
   * Make warnings fatal in dpkg-repos-admin-debian, dgit-ssh-dispatch
     (using setup_sigwarn).
   * Make warnings fatal in tstunt/dpkg-parsechangelog (directly).
+  * When source package contains things called .git (even files, and even
+    in subdirectories), remove them.  Closes:#793671.
 
  --
 
diff --git a/dgit b/dgit
index 9dadc8cce98274eb96944e60b01df5d26a491a95..687ebe14337ce29c8cab701e0b69393875f103f7 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1165,7 +1165,21 @@ sub mktree_in_ud_from_only_subdir () {
     $dirs[0] =~ m#^([^/]+)/\.$# or die;
     my $dir = $1;
     changedir $dir;
-    fail "source package contains .git directory" if stat_exists '.git';
+
+    my @gitscmd = qw(find -name .git -prune -print0);
+    debugcmd "|",@gitscmd;
+    open GITS, "-|", @gitscmd or failedcmd @gitscmd;
+    {
+       local $/="\0";
+       while (<GITS>) {
+           chomp or die;
+           print STDERR "$us: warning: removing from source package: ",
+               (messagequote $_), "\n";
+           rmtree $_;
+       }
+    }
+    $!=0; $?=0; close GITS or failedcmd @gitscmd;
+
     mktree_in_ud_here();
     my $format=get_source_format();
     if (madformat($format)) {