git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true
@ 2010-10-05 10:18 Will Palmer
  2010-10-05 11:48 ` Mathias Lafeldt
  2010-10-05 16:58 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: Will Palmer @ 2010-10-05 10:18 UTC (permalink / raw)
  To: git

I started receiving this error during "git svn dcommit" today:

Use of uninitialized value $hash in string eq
at /home/wpalmer/libexec/git-core/git-svn line 1534.

Examining that section reveals that git-svn is running 
"git log --no-color --first-parent --pretty=medium"

and parsing the output in order to find commit hashes and git-svn-id:
lines. This breaks when log.decorate is true.

This could be patched-up by adding "--no-decorate" to the options
git-svn passes, but that seems to me like it would just be adding to the
pile, as "--pretty=medium" is a moving target. I assume the correct
solution is to specify the format exactly as it is expected.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true
  2010-10-05 10:18 [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true Will Palmer
@ 2010-10-05 11:48 ` Mathias Lafeldt
  2010-10-05 16:58 ` Jeff King
  1 sibling, 0 replies; 5+ messages in thread
From: Mathias Lafeldt @ 2010-10-05 11:48 UTC (permalink / raw)
  To: Will Palmer; +Cc: git, Eric Wong

Will Palmer wrote:
> I started receiving this error during "git svn dcommit" today:
> 
> Use of uninitialized value $hash in string eq
> at /home/wpalmer/libexec/git-core/git-svn line 1534.
> 
> Examining that section reveals that git-svn is running 
> "git log --no-color --first-parent --pretty=medium"
> 
> and parsing the output in order to find commit hashes and git-svn-id:
> lines. This breaks when log.decorate is true.
> 
> This could be patched-up by adding "--no-decorate" to the options
> git-svn passes, but that seems to me like it would just be adding to the
> pile, as "--pretty=medium" is a moving target. I assume the correct
> solution is to specify the format exactly as it is expected.

I recently submitted a patch adding --no-decorate:
http://article.gmane.org/gmane.comp.version-control.git/156919

And it's already in Eric's git-svn branch:
git://git.bogomips.org/git-svn

-Mathias

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true
  2010-10-05 10:18 [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true Will Palmer
  2010-10-05 11:48 ` Mathias Lafeldt
@ 2010-10-05 16:58 ` Jeff King
  2010-10-05 17:53   ` Mathias Lafeldt
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2010-10-05 16:58 UTC (permalink / raw)
  To: Will Palmer; +Cc: Eric Wong, git

On Tue, Oct 05, 2010 at 11:18:46AM +0100, Will Palmer wrote:

> I started receiving this error during "git svn dcommit" today:
> 
> Use of uninitialized value $hash in string eq
> at /home/wpalmer/libexec/git-core/git-svn line 1534.
> 
> Examining that section reveals that git-svn is running 
> "git log --no-color --first-parent --pretty=medium"
> 
> and parsing the output in order to find commit hashes and git-svn-id:
> lines. This breaks when log.decorate is true.
> 
> This could be patched-up by adding "--no-decorate" to the options
> git-svn passes, but that seems to me like it would just be adding to the
> pile, as "--pretty=medium" is a moving target. I assume the correct
> solution is to specify the format exactly as it is expected.

The problem isn't necessarily --pretty=medium, but that we are using
"git log" instead of "git rev-list" (though because "git log" does have
some features that rev-list does not have, we do turn off most
configurable features for "git log --pretty=raw").

So I think the simplest thing is just the patch below (which has only
been lightly tested by me):

-- >8 --
Subject: [PATCH] git-svn: use rev-list instead of log

We are parsing the output, so we don't want user
configuration like color or decorations to appear in the
output. The simplest way to accomplish this is to use the
rev-list plumbing instead of the log porcelain.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index d292224..03d93d8 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {
 
 sub working_head_info {
 	my ($head, $refs) = @_;
-	my @args = ('log', '--no-color', '--first-parent', '--pretty=medium');
+	my @args = ('rev-list', '--first-parent', '--pretty=medium');
 	my ($fh, $ctx) = command_output_pipe(@args, $head);
 	my $hash;
 	my %max;
-- 
1.7.3.1.158.g8f5ae

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true
  2010-10-05 16:58 ` Jeff King
@ 2010-10-05 17:53   ` Mathias Lafeldt
  2010-10-05 18:02     ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Mathias Lafeldt @ 2010-10-05 17:53 UTC (permalink / raw)
  To: Jeff King; +Cc: Will Palmer, Eric Wong, git

On 10/05/2010 06:58 PM, Jeff King wrote:
> On Tue, Oct 05, 2010 at 11:18:46AM +0100, Will Palmer wrote:
> 
>> I started receiving this error during "git svn dcommit" today:
>>
>> Use of uninitialized value $hash in string eq
>> at /home/wpalmer/libexec/git-core/git-svn line 1534.
>>
>> Examining that section reveals that git-svn is running 
>> "git log --no-color --first-parent --pretty=medium"
>>
>> and parsing the output in order to find commit hashes and git-svn-id:
>> lines. This breaks when log.decorate is true.
>>
>> This could be patched-up by adding "--no-decorate" to the options
>> git-svn passes, but that seems to me like it would just be adding to the
>> pile, as "--pretty=medium" is a moving target. I assume the correct
>> solution is to specify the format exactly as it is expected.
> 
> The problem isn't necessarily --pretty=medium, but that we are using
> "git log" instead of "git rev-list" (though because "git log" does have
> some features that rev-list does not have, we do turn off most
> configurable features for "git log --pretty=raw").
> 
> So I think the simplest thing is just the patch below (which has only
> been lightly tested by me):
> 
> -- >8 --
> Subject: [PATCH] git-svn: use rev-list instead of log
> 
> We are parsing the output, so we don't want user
> configuration like color or decorations to appear in the
> output. The simplest way to accomplish this is to use the
> rev-list plumbing instead of the log porcelain.
> 
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  git-svn.perl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index d292224..03d93d8 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {
>  
>  sub working_head_info {
>  	my ($head, $refs) = @_;
> -	my @args = ('log', '--no-color', '--first-parent', '--pretty=medium');
> +	my @args = ('rev-list', '--first-parent', '--pretty=medium');
>  	my ($fh, $ctx) = command_output_pipe(@args, $head);
>  	my $hash;
>  	my %max;

You're right. Using rev-list looks like a much cleaner solution.

In addition, I think we can replace the call to git-log in git_svn_log_cmd() too.

-Mathias

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true
  2010-10-05 17:53   ` Mathias Lafeldt
@ 2010-10-05 18:02     ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2010-10-05 18:02 UTC (permalink / raw)
  To: Mathias Lafeldt; +Cc: Will Palmer, Eric Wong, git

On Tue, Oct 05, 2010 at 07:53:36PM +0200, Mathias Lafeldt wrote:

> > --- a/git-svn.perl
> > +++ b/git-svn.perl
> > @@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {
> >  
> >  sub working_head_info {
> >  	my ($head, $refs) = @_;
> > -	my @args = ('log', '--no-color', '--first-parent', '--pretty=medium');
> > +	my @args = ('rev-list', '--first-parent', '--pretty=medium');
> >  	my ($fh, $ctx) = command_output_pipe(@args, $head);
> >  	my $hash;
> >  	my %max;
> 
> You're right. Using rev-list looks like a much cleaner solution.
> 
> In addition, I think we can replace the call to git-log in git_svn_log_cmd() too.

I don't think so. It uses diff options like "--raw --name-status" which
rev-list does not support. I think it is not buggy, though, as it uses
--format=raw.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-05 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-05 10:18 [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true Will Palmer
2010-10-05 11:48 ` Mathias Lafeldt
2010-10-05 16:58 ` Jeff King
2010-10-05 17:53   ` Mathias Lafeldt
2010-10-05 18:02     ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).