Re: [RFH/PATCH] prefix_path(): disallow absolute paths
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Jan 29, 2008, 07:43 UTC
- Message-ID
- <479ED92E.4020709@viscovery.net>
- In-Reply-To
- <7v3ashqedx.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 10 quoted lines
> Johannes Sixt <j.sixt@viscovery.net> writes: > >> I appreciate this new sanitary_copy_path() because I expect that we will >> need at least one less #ifdef __MINGW32__/#endif compared to our current >> Windows port. > > I would have expected that the whole function would have > platform specific implementation to deal with Windows, not just > ifdef sprinkled everywhere that says "Oh, on this platform > directory separator is a backslash".
I agree. Therefore, we would have *one* conditionalized definition of is_dir_sep() upfront, and use that in place of c == '/'.
The #ifdef I'm addressing above is one that we had to introduce because in the old implementation of prefix_path() on Windows we had to rewrite the path more often than on *nix due to '\\' => '/' conversion. In your new implementation this rewriting now always takes place, but on *nix it more often turns out to be an identity operation.
> Especially I have no idea how would that drive lettter stuff > would/should work. When you are in C:\Documents\Panda\, how > would you express D:\Movie\Porn\My Favorite.mpg as a relative > path?
You can't. But when would this be necessary?
-- Hannes