X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/87aeee89afd99df4c3d15ba53e18ecf66deb96dd..8cfc9de1be353fe0ddf3f5dbd9d5b46f6d99abb1:/mr diff --git a/mr b/mr index d4c3b25..e41264c 100755 --- a/mr +++ b/mr @@ -316,7 +316,7 @@ elsif ($action eq 'config') { } my $section=shift; if ($section=~/^\//) { - # try to convert to a path relative to $config's dir + # try to convert to a path relative to the config file my ($dir)=$ENV{MR_CONFIG}=~/^(.*\/)[^\/]+$/; if ($section=~/^\Q$dir\E(.*)/) { $section=$1; @@ -362,7 +362,7 @@ foreach my $topdir (sort keys %config) { my $d=$directory; $dir.="/" unless $dir=~/\/$/; $d.="/" unless $d=~/\/$/; - next if $dir ne $directory && $dir !~ /^\Q$directory\E/; + next if $dir ne $d && $dir !~ /^\Q$d\E/; push @repos, [$dir, $topdir, $subdir]; } } @@ -426,7 +426,13 @@ sub action { #{{{ push @skipped, $dir; return; } + $dir=~s/^(.*)\/[^\/]+\/?$/$1/; + + if (! -d $dir) { + print "mr $action: creating parent directory $dir\n" if $verbose; + my $ret=system("mkdir", "-p", $dir); + } } elsif ($action eq 'update') { if (! -d $dir) { @@ -531,7 +537,7 @@ if ($stats) { print "mr $action: (skipped: ".join(" ", @skipped).")\n"; } if (@failed) { - print "mr $action: (failed: ".join(" ", @failed).")\n"; + print STDERR "mr $action: (failed: ".join(" ", @failed).")\n"; } } if (@failed) {