Control: tags 793671 + patch pending

Ian Jackson writes ("Re: Bug#793671: dgit clone python-numpy experimental 
fails"):
> dgit needs to get rid of things like this.  (Currently it bails if it
> finds .git in the package toplevel, but I think it would be better if
> it removed this, and .git anywhere else too.  Perhaps with a warning.)

A fix for this is here, or in the patch below.

http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=shortlog;h=refs/heads/fix.793671

(NB that is the result of a rebase onto 1.0, so the future history
will not descend from that.)

Ian.

diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index edb338c..ba3e688 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -25,7 +25,7 @@ BEGIN {
                       initdebug enabledebug enabledebuglevel
                       printdebug debugcmd
                       $debugprefix *debuglevel *DEBUG
-                      shellquote printcmd);
+                      shellquote printcmd messagequote);
     # implicitly uses $main::us
     %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO)] );
     @EXPORT_OK   = @{ $EXPORT_TAGS{policyflags} };
@@ -73,6 +73,16 @@ sub printdebug {
     print DEBUG $debugprefix, @_ or die $! if $debuglevel>0;
 }
 
+sub messagequote ($) {
+    local ($_) = @_;
+    s{\\}{\\\\}g;
+    s{\n}{\\n}g;
+    s{\x08}{\\b}g;
+    s{\t}{\\t}g;
+    s{[\000-\037\177]}{ sprintf "\\x%02x", ord $& }ge;
+    $_;
+}
+
 sub shellquote {
     my @out;
     local $_;
diff --git a/debian/changelog b/debian/changelog
index e9b934b..e77e8f9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 9e2e66e..109f79c 100755
--- 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)) {


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to