From: Dobrica Pavlinusic Date: Thu, 11 Aug 2022 13:48:49 +0000 (+0200) Subject: make bak grep same as git grep, bak log-grep to filter logs X-Git-Url: http://git.rot13.org/?p=bak-git.git;a=commitdiff_plain;h=9ed20c6b93f02be410e442df7acf24b6cd207339 make bak grep same as git grep, bak log-grep to filter logs --- diff --git a/bak-git-server.pl b/bak-git-server.pl index b4c7eec..3bd5f63 100755 --- a/bak-git-server.pl +++ b/bak-git-server.pl @@ -27,6 +27,8 @@ bak command, overview: bak diff [host:][/path] bak status [/path] bak log [/path] + bak log-grep pattern + bak grep pattern bak show bak ch[anges] @@ -182,7 +184,7 @@ while (my $client = $server->accept()) { chomp($line); my $peerhost = $client->peerhost; - if ( $peerhost !~ m/^(10\.13\.37\.|10\.60\.0\.)/ ) { + if ( $peerhost !~ m/^(10\.13\.37\.|10\.60\.0\.|10\.200\.100\.)/ ) { print $client "$peerhost not allowed\n"; next; } @@ -284,8 +286,10 @@ while (my $client = $server->accept()) { print $client `ls $file_path 2>&1`; } elsif ( $command eq 'show' ) { print $client `git show $rel_path`; + } elsif ( $command eq 'log-grep' ) { + #print $client `git log -g --grep=$rel_path`; } elsif ( $command eq 'grep' ) { - print $client `git log -g --grep=$rel_path`; + print $client `git grep $rel_path`; } elsif ( $command eq 'find' ) { print $client `find . -iname '*$rel_path*' | sed -e 's,^./,,' -e 's,/,:/,'` } elsif ( $command eq 'link' ) {