git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Robert Newson <robert.newson@gmail.com>, git@vger.kernel.org
Subject: Re: git-svn: Protect against "diff.color = true".
Date: Fri, 31 Aug 2007 14:58:21 -0700	[thread overview]
Message-ID: <20070831215752.GA31033@untitled> (raw)
In-Reply-To: <7v4pifxuia.fsf_-_@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> wrote:
> If the configuration of the user has "diff.color = true", the
> output from "log" we invoke internally added color codes, which
> broke the parser.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> 
>   Junio C Hamano <gitster@pobox.com> writes:
> 
>   > We probably should do two things to resolve this.
>   >
>   >  * Protect our scripts.  When parsing from "git log" and any
>   >    other Porcelain, explicitly give --no-color.
> 
>   Here is my attempt -- I do not have an easy access to SVN repo
>   to interoperate with, so a testing by real-world users and an
>   Ack is appreciated.  I think some fix for this issue (not
>   necessarily this patch) should be in 1.5.3 final.

Works for me here, although switching back to git-rev-list
(--pretty=raw) would make me more comfortable.

Acked-by: Eric Wong <normalperson@yhbt.net>

>  git-svn.perl |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 4e325b7..98218da 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -807,7 +807,7 @@ sub cmt_metadata {
>  
>  sub working_head_info {
>  	my ($head, $refs) = @_;
> -	my ($fh, $ctx) = command_output_pipe('log', $head);
> +	my ($fh, $ctx) = command_output_pipe('log', '--no-color', $head);
>  	my $hash;
>  	my %max;
>  	while (<$fh>) {
> @@ -2072,7 +2072,7 @@ sub rebuild {
>  		return;
>  	}
>  	print "Rebuilding $db_path ...\n";
> -	my ($log, $ctx) = command_output_pipe("log", $self->refname);
> +	my ($log, $ctx) = command_output_pipe("log", '--no-color', $self->refname);
>  	my $latest;
>  	my $full_url = $self->full_url;
>  	remove_username($full_url);

-- 
Eric Wong

      parent reply	other threads:[~2007-08-31 21:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-31 12:58 Perl warning in git-svn (git v1.5.3-rc7-16-ge340d7d) Robert Newson
2007-08-31 14:52 ` Junio C Hamano
2007-08-31 15:21   ` Eric Wong
2007-08-31 15:31     ` Robert Newson
2007-08-31 16:09     ` Junio C Hamano
2007-08-31 16:18       ` Robert Newson
2007-08-31 16:25         ` Robert Newson
2007-08-31 16:25         ` Robert Newson
2007-08-31 20:50     ` Junio C Hamano
2007-08-31 21:22       ` Junio C Hamano
2007-08-31 23:47         ` Sam Vilain
2007-08-31 23:51           ` Johannes Schindelin
2007-08-31 21:29       ` git-svn: Protect against "diff.color = true" Junio C Hamano
2007-08-31 21:38         ` Johannes Schindelin
2007-08-31 21:46           ` Junio C Hamano
2007-08-31 21:53             ` Johannes Schindelin
2007-08-31 22:14               ` Junio C Hamano
2007-08-31 21:58         ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070831215752.GA31033@untitled \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=robert.newson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).