Skip Menu |

This queue is for tickets about the Git-Repository CPAN distribution.

Report information
The Basics
Id: 87334
Status: resolved
Priority: 0/
Queue: Git-Repository

People
Owner: Nobody in particular
Requestors: jeffa [...] unlocalhost.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Not able to successfully use command() with --grep option
Date: Thu, 25 Jul 2013 17:39:53 -0700
To: bug-git-repository [...] rt.cpan.org
From: Jeff Anderson <jeffa [...] unlocalhost.com>
Greetings, I am unable to query my git repository logs with the --grep option. Please consider the following code: use Git::Repository 'Log'; my $location = '/tmp/foo.git'; my $r = Git::Repository->new( work_tree => $location ); my $since = '3-days-ago'; my $grep = 'report'; my $cmd = $r->command( log => "--since='$since'", "--grep='$grep'" ); print Dumper $cmd; print $cmd->final_output(); # print nothing $cmd = $r->command( log => "--since='$since'"); print Dumper $cmd; print $cmd->final_output(); # prints all logs since including the one that clearly contains the term 'report' Am i doing something wrong? Is this a bug? Has anyone else tried this yet because i cannot find any previous cases where others have used --grep with this (super awesome) module. I also tried run() and log() via the Log plugin with no success, FWIW. Thanks in advance! jeffa
Subject: Re: [rt.cpan.org #87334] AutoReply: Not able to successfully use command() with --grep option
Date: Thu, 25 Jul 2013 17:49:12 -0700
To: bug-Git-Repository [...] rt.cpan.org
From: Jeff Anderson <jeffa [...] unlocalhost.com>
This was an ultimate case of rubber ducking. The problem was with the quotes i was wrapping around the grep string itself. Once i removed those i was able to retrieve my target log lines: my $cmd = $r->command( log => "--since=$since", "--grep=$grep" ); This also works for multiple search terms, such as "report ticket" Sorry! :) On Thu, Jul 25, 2013 at 5:40 PM, Bugs in Git-Repository via RT < bug-Git-Repository@rt.cpan.org> wrote: Show quoted text
> > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Not able to successfully use command() with --grep option", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #87334]. Your ticket is accessible > on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=87334 > > Please include the string: > > [rt.cpan.org #87334] > > in the subject line of all future correspondence about this issue. To do > so, > you may reply to this message. > > Thank you, > bug-Git-Repository@rt.cpan.org > > ------------------------------------------------------------------------- > Greetings, > > I am unable to query my git repository logs with the --grep option. Please > consider the following code: > > use Git::Repository 'Log'; > > my $location = '/tmp/foo.git'; > my $r = Git::Repository->new( work_tree => $location ); > > my $since = '3-days-ago'; > my $grep = 'report'; > > my $cmd = $r->command( log => "--since='$since'", "--grep='$grep'" ); > print Dumper $cmd; > print $cmd->final_output(); > # print nothing > > $cmd = $r->command( log => "--since='$since'"); > print Dumper $cmd; > print $cmd->final_output(); > # prints all logs since including the one that clearly contains the term > 'report' > > > Am i doing something wrong? Is this a bug? Has anyone else tried this yet > because i cannot find any previous cases where others have used --grep with > this (super awesome) module. I also tried run() and log() via the Log > plugin with no success, FWIW. > > Thanks in advance! > jeffa >
On Thu Jul 25 20:49:26 2013, jeffa@unlocalhost.com wrote: Show quoted text
> This was an ultimate case of rubber ducking. The problem was with the > quotes i was wrapping around the grep string itself. Once i removed > those i > was able to retrieve my target log lines: > > my $cmd = $r->command( log => "--since=$since", "--grep=$grep" ); > > This also works for multiple search terms, such as "report ticket"
Don't worry. I think it's just confusion from stuff you have to do in the shell (like adding quotes to command-line parameters) and that you don't need to do with Git::Repository (actually, exec()) because there's no need to quote strings at that level. It might actually make a good example for the Tutorial page. Thanks for the report, and for letting me know it wasn't my fault after all. ;-) -- BooK