On Thu, Dec 15, 2016 at 08:30:52AM +0100, Torsten Bögershausen wrote:

> > > 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.

I don't have an opinion either way on what Windows would want, but note
that the function already _does_ convert separators to slashes. With
Johannes's original patch, you'd end up with a mix, like:

  \\server\share/dir1/file

So this conversion is really just retaining the original behavior, and
making it consistent throughout the path.

Which isn't to say that the function as it currently exists isn't a
little bit buggy. :)

One of the points of normalizing, though, is that Git can then do
textual comparisons between the output. So I think there's value in
having a canonical internal representation, even if the OS could handle
more exotic ones.

-Peff

Reply via email to