make source and destination directory for diff
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 11 Mar 2011 16:24:49 +0000 (17:24 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 11 Mar 2011 16:24:49 +0000 (17:24 +0100)
This allows diffing files which are not added on source or destination
host

bak-git-server.pl

index 959d2a7..5e656a0 100755 (executable)
@@ -168,7 +168,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";
+                       mkpath $_ foreach grep { ! -e $_ } ( "$hostname/$dir", "$on_host/$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");