All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Eric Wong <normalperson@yhbt.net>, Andrej Manduch <amanduch@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] git svn: info: correctly handle absolute path args
Date: Sun, 07 Sep 2014 10:57:43 +0200	[thread overview]
Message-ID: <540C1E07.7030105@kdbg.org> (raw)
In-Reply-To: <20140907080626.GA6273@dcvr.yhbt.net>

Am 07.09.2014 10:06, schrieb Eric Wong:
> diff --git a/git-svn.perl b/git-svn.perl
> index 1f41ee1..47cd6ea 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1477,10 +1477,20 @@ sub cmd_commit_diff {
>  	}
>  }
>  
> -
>  sub cmd_info {
> -	my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
> -	my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
> +	my $path_arg = defined($_[0]) ? $_[0] : '.';
> +	my $path = $path_arg;
> +	if ($path =~ m!\A/!) {

There must be a more portable way to check for an absolute path. Think
of DOS-style paths...

> +		my $toplevel = eval {
> +			my @cmd = qw/rev-parse --show-toplevel/;
> +			command_oneline(\@cmd, STDERR => 0);
> +		};
> +		$path = canonicalize_path($path);
> +		$path =~ s!\A\Q$toplevel\E/?!!;
> +		$path = canonicalize_path($path);
> +	} else {
> +		$path = canonicalize_path($cmd_dir_prefix . $path);
> +	}
>  	if (exists $_[1]) {
>  		die "Too many arguments specified\n";
>  	}

-- Hannes

  reply	other threads:[~2014-09-07  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07  8:06 [PATCH v2] git svn: info: correctly handle absolute path args Eric Wong
2014-09-07  8:57 ` Johannes Sixt [this message]
2014-09-08  0:22   ` brian m. carlson
2014-09-09  6:38     ` [PATCH v3] " Eric Wong

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=540C1E07.7030105@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=amanduch@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.