git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] git svn: info: correctly handle absolute path args

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 7, 2014, 08:57 UTC
Message-ID
<540C1E07.7030105@kdbg.org>
In-Reply-To
<20140907080626.GA6273@dcvr.yhbt.net>
Am 07.09.2014 10:06, schrieb Eric Wong:
Show 15 quoted lines
> 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...

Show 13 quoted lines
> +		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
Previous: Eric WongNext: brian m. carlson
Message 2 of 4 in “git svn: info: correctly handle absolute path args”
  1. git svn: info: correctly handle absolute path argsEric Wong, Sep 7, 2014
  2. Johannes SixtSep 7, 2014
  3. brian m. carlsonSep 8, 2014
  4. git svn: info: correctly handle absolute path argsEric Wong, Sep 9, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.