From: Dobrica Pavlinusic Date: Wed, 17 Feb 2010 22:15:00 +0000 (+0100) Subject: few more commands X-Git-Url: http://git.rot13.org/?p=bak-git.git;a=commitdiff_plain;h=eaf3e296bdbfb29a48bd7463cccc7ec8baaf5f04 few more commands - without any arguments updates all files tracked from client - shows output of diff, status and log on client --- diff --git a/server.pl b/server.pl index f1e7aa4..ebfdb31 100755 --- a/server.pl +++ b/server.pl @@ -53,14 +53,20 @@ while (my $client = $server->accept()) { mkpath "$ip/$dir" unless -e "$ip/$dir"; - if ( $command eq 'add' ) { - warn 'rsync', "root\@$ip:$path", "$ip/$path"; - system 'rsync', "root\@$ip:$path", "$ip/$path"; + if ( ! $command ) { + system "find $ip -type f | sed 's,$ip,,' > /tmp/$ip.list"; + system "rsync -avv --files-from /tmp/$ip.list root\@$ip:/ $ip/" + } elsif ( $command eq 'add' ) { + system 'rsync', '-avv', "root\@$ip:$path", "$ip/$path"; system 'git', 'add', "$ip/$path"; - } else { - system 'rsync', "root\@$ip:$path", "$ip/$path"; + } elsif ( $command eq 'commit' ) { + system 'rsync', '-avv', "root\@$ip:$path", "$ip/$path"; $message ||= "$command $ip $path"; system 'git', 'commit', '-m', $message, "$ip/$path"; + } elsif ( $command =~ m{(diff|status|log)} ) { + print $client `git $command $ip`; + } else { + print $client "Unknown command: $command\n"; } }