From: Ian Jackson Date: Sun, 26 Jul 2015 21:20:24 +0000 (+0100) Subject: Break out remove_stray_gits X-Git-Tag: debian/1.1~23 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=daa72e2ec119b82756efa0ead41d9e6a29e35d3a Break out remove_stray_gits --- diff --git a/dgit b/dgit index 660c0c33..40e50d17 100755 --- a/dgit +++ b/dgit @@ -1217,14 +1217,7 @@ sub git_write_tree () { return $tree; } -sub mktree_in_ud_from_only_subdir () { - # changes into the subdir - my (@dirs) = <*/.>; - die unless @dirs==1; - $dirs[0] =~ m#^([^/]+)/\.$# or die; - my $dir = $1; - changedir $dir; - +sub remove_stray_gits () { my @gitscmd = qw(find -name .git -prune -print0); debugcmd "|",@gitscmd; open GITS, "-|", @gitscmd or failedcmd @gitscmd; @@ -1238,7 +1231,17 @@ sub mktree_in_ud_from_only_subdir () { } } $!=0; $?=0; close GITS or failedcmd @gitscmd; +} + +sub mktree_in_ud_from_only_subdir () { + # changes into the subdir + my (@dirs) = <*/.>; + die unless @dirs==1; + $dirs[0] =~ m#^([^/]+)/\.$# or die; + my $dir = $1; + changedir $dir; + remove_stray_gits(); mktree_in_ud_here(); my $format=get_source_format(); if (madformat($format)) {