{"thread":{"id":"25354","subject":"[BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","startedAt":"2010-10-05T10:18:46Z","lastAt":"2010-10-05T18:02:14Z","messageCount":5,"participants":["Will Palmer","Mathias Lafeldt","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"152661","messageId":"1286273926.2364.6.camel@wpalmer.simply-domain","threadId":"25354","inReplyTo":null,"subject":"[BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","fromName":"Will Palmer","fromEmail":"wmpalmer@gmail.com","sentAt":"2010-10-05T10:18:46Z","receivedAt":"2010-10-05T10:18:46Z","isPatch":false,"sender":{"key":"wmpalmer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/357044?v=4"},"body":"I started receiving this error during \"git svn dcommit\" today:\n\nUse of uninitialized value $hash in string eq\nat /home/wpalmer/libexec/git-core/git-svn line 1534.\n\nExamining that section reveals that git-svn is running \n\"git log --no-color --first-parent --pretty=medium\"\n\nand parsing the output in order to find commit hashes and git-svn-id:\nlines. This breaks when log.decorate is true.\n\nThis could be patched-up by adding \"--no-decorate\" to the options\ngit-svn passes, but that seems to me like it would just be adding to the\npile, as \"--pretty=medium\" is a moving target. I assume the correct\nsolution is to specify the format exactly as it is expected.\n"},{"id":"152666","messageId":"4CAB1093.7000204@debugon.org","threadId":"25354","inReplyTo":"1286273926.2364.6.camel@wpalmer.simply-domain","subject":"Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","fromName":"Mathias Lafeldt","fromEmail":"misfire@debugon.org","sentAt":"2010-10-05T11:48:35Z","receivedAt":"2010-10-05T11:48:35Z","isPatch":false,"sender":{"key":"misfire@debugon.org","avatar":"https://avatars.githubusercontent.com/u/158074?v=4"},"body":"Will Palmer wrote:\n> I started receiving this error during \"git svn dcommit\" today:\n> \n> Use of uninitialized value $hash in string eq\n> at /home/wpalmer/libexec/git-core/git-svn line 1534.\n> \n> Examining that section reveals that git-svn is running \n> \"git log --no-color --first-parent --pretty=medium\"\n> \n> and parsing the output in order to find commit hashes and git-svn-id:\n> lines. This breaks when log.decorate is true.\n> \n> This could be patched-up by adding \"--no-decorate\" to the options\n> git-svn passes, but that seems to me like it would just be adding to the\n> pile, as \"--pretty=medium\" is a moving target. I assume the correct\n> solution is to specify the format exactly as it is expected.\n\nI recently submitted a patch adding --no-decorate:\nhttp://article.gmane.org/gmane.comp.version-control.git/156919\n\nAnd it's already in Eric's git-svn branch:\ngit://git.bogomips.org/git-svn\n\n-Mathias\n"},{"id":"152693","messageId":"20101005165830.GA13413@sigill.intra.peff.net","threadId":"25354","inReplyTo":"1286273926.2364.6.camel@wpalmer.simply-domain","subject":"Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-10-05T16:58:31Z","receivedAt":"2010-10-05T16:58:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Oct 05, 2010 at 11:18:46AM +0100, Will Palmer wrote:\n\n> I started receiving this error during \"git svn dcommit\" today:\n> \n> Use of uninitialized value $hash in string eq\n> at /home/wpalmer/libexec/git-core/git-svn line 1534.\n> \n> Examining that section reveals that git-svn is running \n> \"git log --no-color --first-parent --pretty=medium\"\n> \n> and parsing the output in order to find commit hashes and git-svn-id:\n> lines. This breaks when log.decorate is true.\n> \n> This could be patched-up by adding \"--no-decorate\" to the options\n> git-svn passes, but that seems to me like it would just be adding to the\n> pile, as \"--pretty=medium\" is a moving target. I assume the correct\n> solution is to specify the format exactly as it is expected.\n\nThe problem isn't necessarily --pretty=medium, but that we are using\n\"git log\" instead of \"git rev-list\" (though because \"git log\" does have\nsome features that rev-list does not have, we do turn off most\nconfigurable features for \"git log --pretty=raw\").\n\nSo I think the simplest thing is just the patch below (which has only\nbeen lightly tested by me):\n\n-- >8 --\nSubject: [PATCH] git-svn: use rev-list instead of log\n\nWe are parsing the output, so we don't want user\nconfiguration like color or decorations to appear in the\noutput. The simplest way to accomplish this is to use the\nrev-list plumbing instead of the log porcelain.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n git-svn.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d292224..03d93d8 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {\n \n sub working_head_info {\n \tmy ($head, $refs) = @_;\n-\tmy @args = ('log', '--no-color', '--first-parent', '--pretty=medium');\n+\tmy @args = ('rev-list', '--first-parent', '--pretty=medium');\n \tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n \tmy $hash;\n \tmy %max;\n-- \n1.7.3.1.158.g8f5ae\n"},{"id":"152696","messageId":"4CAB6620.4000909@debugon.org","threadId":"25354","inReplyTo":"20101005165830.GA13413@sigill.intra.peff.net","subject":"Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","fromName":"Mathias Lafeldt","fromEmail":"misfire@debugon.org","sentAt":"2010-10-05T17:53:36Z","receivedAt":"2010-10-05T17:53:36Z","isPatch":false,"sender":{"key":"misfire@debugon.org","avatar":"https://avatars.githubusercontent.com/u/158074?v=4"},"body":"On 10/05/2010 06:58 PM, Jeff King wrote:\n> On Tue, Oct 05, 2010 at 11:18:46AM +0100, Will Palmer wrote:\n> \n>> I started receiving this error during \"git svn dcommit\" today:\n>>\n>> Use of uninitialized value $hash in string eq\n>> at /home/wpalmer/libexec/git-core/git-svn line 1534.\n>>\n>> Examining that section reveals that git-svn is running \n>> \"git log --no-color --first-parent --pretty=medium\"\n>>\n>> and parsing the output in order to find commit hashes and git-svn-id:\n>> lines. This breaks when log.decorate is true.\n>>\n>> This could be patched-up by adding \"--no-decorate\" to the options\n>> git-svn passes, but that seems to me like it would just be adding to the\n>> pile, as \"--pretty=medium\" is a moving target. I assume the correct\n>> solution is to specify the format exactly as it is expected.\n> \n> The problem isn't necessarily --pretty=medium, but that we are using\n> \"git log\" instead of \"git rev-list\" (though because \"git log\" does have\n> some features that rev-list does not have, we do turn off most\n> configurable features for \"git log --pretty=raw\").\n> \n> So I think the simplest thing is just the patch below (which has only\n> been lightly tested by me):\n> \n> -- >8 --\n> Subject: [PATCH] git-svn: use rev-list instead of log\n> \n> We are parsing the output, so we don't want user\n> configuration like color or decorations to appear in the\n> output. The simplest way to accomplish this is to use the\n> rev-list plumbing instead of the log porcelain.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  git-svn.perl |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index d292224..03d93d8 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {\n>  \n>  sub working_head_info {\n>  \tmy ($head, $refs) = @_;\n> -\tmy @args = ('log', '--no-color', '--first-parent', '--pretty=medium');\n> +\tmy @args = ('rev-list', '--first-parent', '--pretty=medium');\n>  \tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n>  \tmy $hash;\n>  \tmy %max;\n\nYou're right. Using rev-list looks like a much cleaner solution.\n\nIn addition, I think we can replace the call to git-log in git_svn_log_cmd() too.\n\n-Mathias\n"},{"id":"152697","messageId":"20101005180214.GA12861@sigill.intra.peff.net","threadId":"25354","inReplyTo":"4CAB6620.4000909@debugon.org","subject":"Re: [BUG] git-svn parses --pretty=medium log output, fails when log.decorate is true","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-10-05T18:02:14Z","receivedAt":"2010-10-05T18:02:14Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Oct 05, 2010 at 07:53:36PM +0200, Mathias Lafeldt wrote:\n\n> > --- a/git-svn.perl\n> > +++ b/git-svn.perl\n> > @@ -1514,7 +1514,7 @@ sub cmt_sha2rev_batch {\n> >  \n> >  sub working_head_info {\n> >  \tmy ($head, $refs) = @_;\n> > -\tmy @args = ('log', '--no-color', '--first-parent', '--pretty=medium');\n> > +\tmy @args = ('rev-list', '--first-parent', '--pretty=medium');\n> >  \tmy ($fh, $ctx) = command_output_pipe(@args, $head);\n> >  \tmy $hash;\n> >  \tmy %max;\n> \n> You're right. Using rev-list looks like a much cleaner solution.\n> \n> In addition, I think we can replace the call to git-log in git_svn_log_cmd() too.\n\nI don't think so. It uses diff options like \"--raw --name-status\" which\nrev-list does not support. I think it is not buggy, though, as it uses\n--format=raw.\n\n-Peff\n"}]}