On 14/12/16 20:37, Johannes Sixt wrote:
normalize_path_copy() is not prepared to keep the double-slash of a
//server/share/dir kind of path, but treats it like a regular POSIX
style path and transforms it to /server/share/dir.
The bug manifests when 'git push //server/share/dir master' is run,
because tmp_objdir_add_as_alternate() uses the path in normalized
form when it registers the quarantine object database via
link_alt_odb_entries(). Needless to say that the directory cannot be
accessed using the wrongly normalized path.
Fix it by skipping all of the root part, not just a potential drive
prefix. offset_1st_component takes care of this, see the
implementation in compat/mingw.c::mingw_offset_1st_component().
Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
---
Am 14.12.2016 um 18:30 schrieb Jeff King:
Would it be reasonable to
write:
/* Copy initial part of absolute path, converting separators on Windows */
const char *end = src + offset_1st_component(src);
while (src < end) {
char c = *src++;
if (c == '\\')
c = '/';
*dst++ = c;
}
Makes a lot of sense! I haven't had an opportunity, though, to test
on Windows.
I'm not sure, if a conversion should be done here, in this part of code.
To my knowledge,
C:\dir1\file
is the same
as
C:/dir1/file
and that is handled by windows.
The \\server\share\dir1\file is native to windows,
and I can't see good reasons to change '\' into '/' somewhere in Git,
when UNC is used.
Cygwin does a translation from
//server/share/dir1/file
into
\\server\share\dir1\file
In other words:
The patch looks good as is, and once I get a Windows machine,
may be able to do some testing and come up with test cases
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx>
[]