add multiple files
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 5 Aug 2010 14:38:32 +0000 (16:38 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 5 Aug 2010 14:38:32 +0000 (16:38 +0200)
bak-git-server.pl

index 2b223c6..a87473e 100755 (executable)
@@ -116,6 +116,9 @@ while (my $client = $server->accept()) {
        my $path = $rel_path =~ m{^/} ? $rel_path : "$pwd/$rel_path";
 
        warn "$hostname [$command] $on_host:$path | $message\n";
+
+       my $args_message = $message;
+
        $message ||= "$path [$command]";
        $message = "$hostname: $message";
 
@@ -136,8 +139,14 @@ while (my $client = $server->accept()) {
                pull_changes $hostname;
        } elsif ( $command eq 'add' ) {
                mkpath "$hostname/$dir" unless -e "$hostname/$dir";
-               system 'rsync', '-avv', "root\@$hostname:$path", "$hostname/$path";
-               print $client git 'add', "$hostname/$path";
+               while ( $path ) {
+                       system 'rsync', '-avv', "root\@$hostname:$path", "$hostname/$path";
+                       print $client git 'add', "$hostname/$path";
+
+                       $args_message =~ s/^(.+)\b// || last;
+                       $path = $1;
+                       warn "? $path";
+               }
        } elsif ( $command eq 'commit' ) {
                pull_changes $hostname;
                $message =~ s/'/\\'/g;