Christopher Baines writes ("Bug#793671: dgit clone python-numpy experimental 
fails"):
> Thanks for your prompt response and patch!

You're welcome.  I'm sorry it wsn't correct.  I should have been more
thorough.

> I have tried it out, and it seems to work, however there is a similar
> looking issue when building the package.

Thanks very much for your quick response and retest.  I think I have
got all the relevant places this time.

I have updated the git branch (fast forward for now, although it will
not be an ancestor of 1.1):

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

and the revised patch is below.

Thanks,
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..550d8e1 100755
--- a/dgit
+++ b/dgit
@@ -1139,6 +1139,22 @@ sub git_write_tree () {
     return $tree;
 }
 
+sub remove_stray_gits () {
+    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;
+}
+
 sub mktree_in_ud_from_only_subdir () {
     # changes into the subdir
     my (@dirs) = <*/.>;
@@ -1146,7 +1162,8 @@ 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';
+
+    remove_stray_gits();
     mktree_in_ud_here();
     my $format=get_source_format();
     if (madformat($format)) {
@@ -2345,6 +2362,7 @@ sub quiltify ($$) {
     # should be contained within debian/patches.
 
     changedir '../fake';
+    remove_stray_gits();
     mktree_in_ud_here();
     rmtree '.pc';
     runcmd @git, 'add', '.';


-- 
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