diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-26 22:20:24 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-27 03:51:44 +0100 |
commit | daa72e2ec119b82756efa0ead41d9e6a29e35d3a (patch) | |
tree | 4f166cbcfbf3e329a610f16567b6c859c124338d /dgit | |
parent | f58339ad566233a2e1252dcf309480029f84ab48 (diff) |
Break out remove_stray_gits
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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)) { |