From: Dobrica Pavlinusic Date: Mon, 25 Oct 2010 12:42:07 +0000 (+0200) Subject: added cat [host:]/path X-Git-Url: http://git.rot13.org/?p=bak-git.git;a=commitdiff_plain;h=b3e5588a5f136f8c1c72f693327c39c8937ef9c1 added cat [host:]/path --- diff --git a/README b/README new file mode 100644 index 0000000..d533a5c --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +Simple tracking of remote files in central git repository +with only shell, netcat, rsync and ssh on client + +http://blog.rot13.org/bak-git/ + + diff --git a/TODO b/TODO index 8661903..ed3db99 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ + commit --author support + diff/revert from another host:/paths/ + bak diff without params doesn't return full host diff ++ bak cat host:/path/to/file - bak ls - daily cron job to create branch with uncommited changes -- bak cat host:/path/to/file diff --git a/bak-git-server.pl b/bak-git-server.pl index 4776cc5..1c8efc1 100755 --- a/bak-git-server.pl +++ b/bak-git-server.pl @@ -26,6 +26,8 @@ bak command overview: bak ch[anges] bak revert [host:]/path + bak cat [host:]/path + bak - push all changed files to server See L for more information @@ -181,6 +183,13 @@ while (my $client = $server->accept()) { print $client git "checkout -- $hostname/$path"; system 'rsync', '-avv', "$hostname/$path", "root\@$hostname:$path"; } + } elsif ( $command eq 'cat' ) { + my $file_path = ( $on_host ? $on_host : $hostname ) . "/$path"; + open(my $file, '<', $file_path) || warn "ERROR $file_path: $!"; + while(<$file>) { + print $client $_; + } + close($file); } else { print $client "Unknown command: $command\n"; }