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

Re: [PATCH] cvsexportcommit: be graceful when "cvs status" reorders the arguments

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Feb 18, 2008, 18:55 UTC
Message-ID
<47B9D484.1020304@catalyst.net.nz>
In-Reply-To
<7v1w7ap0vo.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 6 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
>>> The script uses File::Basename upfront so perhaps just simply...
>> I tried that.  But as the file need not exist, "basename" went on strike.
>>
>> So I'll keep the (ugly) version.

?! basename() never touches the disk. I just read it to confirm - $VERSION is 2.74 and I'm somewhat disappointed to find it's not as portable as I'd expect (perhaps it gets hardcoded during install?).

And my /usr/bin/basename doesn't care if the file exists either
  $ type basename
  basename is /usr/bin/basename
  $ basename /foo/bar/baz
  baz
  $ stat /foo/bar/baz
  stat: cannot stat `/foo/bar/baz': No such file or directory

So I am fairly confident that we can safely use File::Basename's basename() on arbitrary strings that look like a path. We use basename() quite a bit in our perl scripts in git.

cheers,
m
-- 
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ  Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/           PHYS: Level 2, 150-154 Willis St
NZ: +64(4)916-7224    MOB: +64(21)364-017    UK: 0845 868 5733 ext 7224
      Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 12 of 15 in “cvsexportcommit: be graceful when "cvs status" reorders the arguments”
  1. cvsexportcommit: be graceful when "cvs status" reorders the argumentsJohannes Schindelin, Feb 18, 2008
  2. Junio C HamanoFeb 18, 2008
  3. Junio C HamanoFeb 18, 2008
  4. Martin LanghoffFeb 18, 2008
  5. Johannes SchindelinFeb 18, 2008
  6. Martin LanghoffFeb 18, 2008
  7. Johannes SchindelinFeb 18, 2008
  8. cvsexportcommit: be graceful when "cvs status" reorders the argumentsJohannes Schindelin, Feb 18, 2008
  9. Johannes SchindelinFeb 18, 2008
  10. Junio C HamanoFeb 18, 2008
  11. Johannes SchindelinFeb 18, 2008
  12. Martin LanghoffFeb 18, 2008
  13. Johannes SchindelinFeb 18, 2008
  14. Martin LanghoffFeb 18, 2008
  15. Johannes SchindelinFeb 18, 2008

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.