Re: [PATCH 1/2] relative_path should honor dos_drive_prefix
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Sep 13, 2013, 13:59 UTC
- Message-ID
- <52331A52.3010300@web.de>
- In-Reply-To
- <CANYiYbE6nT+9LrekWp7mryJ13RxQBSQ+p6EyQspAKBMj7oG0zQ@mail.gmail.com>
On 13.09.13 06:55, Jiang Xin wrote:
Show 16 quoted lines
> 2013/9/13 Junio C Hamano <gitster@pobox.com>: >> For systems that need POSIX escape hatch for Apollo Domain ;-), we >> would need a bit more work. When both path1 and path2 begin with a >> double-dash, we would need to check if they match up to the next >> slash, so that >> >> - //host1/usr/src and //host1/usr/lib share the same root and the >> former can be made to ../src relative to the latter; >> >> - //host1/usr/src and //host2/usr/lib are of separate roots. >> >> or something. >> >> > But how could we know which platform supports network pathnames and > needs such implementation.
Similar to the has_dos_drive_prefix:
For Windows/Mingw we do like this
mingw.h #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
And all other platforms defines has_dos_drive_prefix() to be 0 here git-compat-util.h #ifndef has_dos_drive_prefix #define has_dos_drive_prefix(path) 0 #endif
mingw.h: #define has_unc_path_prefix(path) ((path)[0] == '/' && (path)[1] == '/') (Or may be) #define has_unc_path_prefix(path) (is_dir_sep((path)[0]) && is_dir_sep((path)[1]))