make destination directory if needed
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Oct 2010 12:36:56 +0000 (14:36 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Oct 2010 12:36:56 +0000 (14:36 +0200)
this allows you to diff files between two machines without adding
them to bak first (which also worked before, but all required
directories needed to be present in bak allready)

bak-git-server.pl

index 67262c9..c979f6e 100755 (executable)
@@ -167,6 +167,7 @@ while (my $client = $server->accept()) {
                $command = 'log --patch-with-stat' if $command =~ m/^ch/;
                pull_changes( $hostname ) if $command eq 'diff';
                if ( $on_host ) {
+                       mkpath "$hostname/$dir" unless -e "$hostname/$dir";
                        rsync( '-avv', "root\@$hostname:$path", "$hostname/$path" );
                        rsync( '-avv', "root\@$on_host:$path", "$on_host/$path" );
                        open(my $diff, '-|', "diff -Nuw $hostname$path $on_host$path");