]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
git: implement date_parse method
[public-inbox.git] / lib / PublicInbox / Git.pm
index c6c1c80205ae8556b1ee976417c37fa2e8baa7ed..9207962bb7df6384eb2f611915dfcddfa555b4a6 100644 (file)
@@ -362,8 +362,7 @@ sub popen {
 
 # same args as popen above
 sub qx {
-       my $self = shift;
-       my $fh = $self->popen(@_);
+       my $fh = popen(@_);
        if (wantarray) {
                local $/ = "\n";
                my @ret = <$fh>;
@@ -377,6 +376,11 @@ sub qx {
        }
 }
 
+sub date_parse {
+       my $d = $_[0]->qx('rev-parse', "--since=$_[1]");
+       substr($d, length('--max-age='), -1)
+}
+
 # check_async and cat_async may trigger the other, so ensure they're
 # both completely done by using this:
 sub async_wait_all ($) {