Re: git-svn: Protect against "diff.color = true".
- From
- Eric Wong <normalperson@yhbt.net>
- Date
- Aug 31, 2007, 21:58 UTC
- Message-ID
- <20070831215752.GA31033@untitled>
- In-Reply-To
- <7v4pifxuia.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> 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>
Show 25 quoted lines
> 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