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:29:52 +0000 (15:29 +0100)
debian/changelog
dgit

index e9b934b2d11454330545b820b388ee1dab1d1af0..e77e8f9c0404336aae8e06155662fb74643be390 100644 (file)
@@ -1,3 +1,10 @@
+dgit (1.1~~) UNRELEASED; urgency=low
+
+  * When source package contains things called .git (even files, and even
+    in subdirectories), remove them.  Closes:#793671.
+
+ --
+
 dgit (1.0) unstable; urgency=medium
 
   Improvements:
diff --git a/dgit b/dgit
index 9e2e66e4841b4adb690225fab1def69b6229df6d..109f79c74ce6d6c178a2bceb8e10ef204cd6a598 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1146,7 +1146,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)) {