add doesn't commit any more
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Feb 2010 20:50:41 +0000 (21:50 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Feb 2010 20:50:41 +0000 (21:50 +0100)
This allows multi-file commit, same as in git

server.pl

index b158748..22bdea0 100755 (executable)
--- a/server.pl
+++ b/server.pl
@@ -25,6 +25,8 @@ while (my $client = $server->accept()) {
        my ($command,$path,$message) = split(/\s+/,<$client>,3);
        my $ip = $client->peerhost;
 
+       $message ||= '';
+
        if ( $command eq 'install' ) {
                print $client '#!/bin/sh',$/,'echo $* | nc 10.60.0.92 9001',$/;
                next;
@@ -48,9 +50,9 @@ while (my $client = $server->accept()) {
                system 'git', 'add', "$ip/$path";
        } else {
                system 'rsync', "root\@$ip:$path", "$ip/$path";
+               $message ||= "$command $ip $path";
+               system 'git', 'commit', '-m', $message, "$ip/$path";
        }
 
-       $message ||= "$command $ip $path";
-       system 'git', 'commit', '-m', $message, "$ip/$path";
 }