Web lists-archives.com

RE: Cygwin Git with Windows paths

On November 18, 2018 22:33, Junio C Hamano wrote:
> "Randall S. Becker" <rsbecker@xxxxxxxxxxxxx> writes:
> >> Torsten Bögershausen <tboegi@xxxxxx> writes:
> >>
> >> > And it may even be that we need a special handling for the "\" to
> >> > be treated as "/".
> >>
> >> I do not do Windows, but is_dir_sep() needs to be tweaked if you want
> >> to do that.
> >
> > Heavy Cygwin user here. It is used in my environment for
> > cross-compilation. Everything should be done using / separators in
> > Cygwin, not \. So /cygdrive/c, /cygdrive/d always prefaces the path
> > rather than C:\ or D:\, which won't parse. It is, essentially, a bash
> > environment, including that git completions work properly. Backslash
> > ends up doing what it would in bash.
> In short, in your opinion, the original message in this thread expresses an
> invalid wish, as C:\path\to\dir\ is not a valid way to spell the path to the
> directory, and it should be written as /cygdrive/c/path/to/dir instead?
> How well does this argument work in the real world, when another claim in
> the original message
>     This causes problems for any non-Cygwin tools that might call Git:
>     http://github.com/golang/go/issues/23155
> is taken into account, I wonder, though?

The solution to this that I ended up with is a blend of many different implementations of git (3) on my dev box. EGit in ECLIPSE, standard windows git for working in a CMD prompt, the Cygwin git in Cygwin bash. On another dev box I also have git bash and Ming, which make things easier, but I have to work in Cygwin for some subsystems. I end up using relative paths with / instead of \ in all cases, and git seems happy, except for /cygdrive/c. Absolute Windows and Cygwin paths simply do not work consistently, from my experience from Cygwin because of the way bash passes arguments to non-cygwin tools. You need to be very careful and properly escape "\" to do so, and account for cygwin drive handling otherwise. So a non-cygwin tool from Cygwin can process c:\ but Cygwin itself will not. My own expectations are that git built for Cygwin would understand this, but git built for Windows would not, and that I should account for this through my PATH, selecting Cygwin git in Cygwin and Windows git elsewhere. Reality may not reflect this, so I use relative paths in all cases (non-reality being that the git port for Cygwin is different than the git port for Windows, which it does not appear to be).