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
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 8, 2014, 00:22 UTC
Message-ID
<20140908002256.GB43902@vauxhall.crustytoothpaste.net>
In-Reply-To
<540C1E07.7030105@kdbg.org>
On Sun, Sep 07, 2014 at 10:57:43AM +0200, Johannes Sixt wrote:
Show 10 quoted lines
> Am 07.09.2014 10:06, schrieb Eric Wong:
> >  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...

You probably want File::Spec->file_name_is_absolute($path). Either that or always turn the path into absolute or relative form with File::Spec->abs2rel or File::Spec->rel2abs, and then go from there.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Johannes SixtNext: Eric Wong
Message 3 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.