From: Torsten Bögershausen Date: Thu, 15 Dec 2016 07:30:52 GMT Subject: Re: [PATCH v2] fix pushing to //server/share/dir on Windows Message-ID: In-Reply-To: <787a421b-8b7a-14c5-768f-06c3dc183cf4@kdbg.org> 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 > --- > 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 []