public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Git issue.
       [not found] <1032375163.9174650.1448234447549.JavaMail.zimbra@comcast.net>
@ 2015-11-22 23:30 ` boulderfans
  2015-12-03 20:42   ` Adam Dinwoodie
  0 siblings, 1 reply; 4+ messages in thread
From: boulderfans @ 2015-11-22 23:30 UTC (permalink / raw)
  To: cygwin

I've run into a problem when using the --git-dir option in git. It appears to have been introduced since git 2.4.x.

Here's an example of the problem using a locally built version (2.6.3) of git with some annotated error output:

[/cygdrive/d/projects]
$ git --version
git version 2.6.3-cyg

[/cygdrive/d/projects]
$ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files
error: Unable to open tempfile: /cygdrive/d/projects/d:/projects/git-git/.git/config.lock
error: could not lock config file d:/projects/git-git/.git/config: No such file or directory

The problem is that the code that is checking the --git-dir option doesn't work properly if you use a DOS drive:/path specification. I tracked it down to the fact that has_dos_drive_prefix() is not implemented and always returns false.  From git-compat-util.h:

#ifndef has_dos_drive_prefix 
static inline int git_has_dos_drive_prefix(const char *path) 
{ 
return 0; 
} 
#define has_dos_drive_prefix git_has_dos_drive_prefix 
#endif 

It looks like there is an implementation of the function for a MinGW build (compat/mingw.c) but not for the Cygwin build. There were changes in this area about a year ago, but I'm not exactly sure what changed to cause this problem to appear.

Thanks. 

-Matt 

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git issue.
  2015-11-22 23:30 ` Git issue boulderfans
@ 2015-12-03 20:42   ` Adam Dinwoodie
  2015-12-04  0:07     ` Matt Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Dinwoodie @ 2015-12-03 20:42 UTC (permalink / raw)
  To: cygwin

On Sun, Nov 22, 2015 at 11:30:27PM +0000, boulderfans wrote:
> [/cygdrive/d/projects]
> $ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files
> error: Unable to open tempfile: /cygdrive/d/projects/d:/projects/git-git/.git/config.lock
> error: could not lock config file d:/projects/git-git/.git/config: No such file or directory
> 
> The problem is that the code that is checking the --git-dir option
> doesn't work properly if you use a DOS drive:/path specification.

Hi Matt,

Cygwin applications, including applications you've compiled yourself
using the Cygwin toolchain, normally expect Cygwin's Linux-like paths,
e.g.  /cygdrive/d/projects/git-git.  Attempting to use Windows paths
simply isn't meant to work.

You can convert from a Windows path to the equivalent Cygwin path using
the cygpath utility, e.g.:

    git --git-dir="$(cygpath 'd:/projects/git-git/.git')" config alias.foo ls-files

Adam

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git issue.
  2015-12-03 20:42   ` Adam Dinwoodie
@ 2015-12-04  0:07     ` Matt Smith
  2015-12-04 17:04       ` Adam Dinwoodie
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Smith @ 2015-12-04  0:07 UTC (permalink / raw)
  To: cygwin

Ok.  I wasn't sure as the behavior changed.  It worked in 1.9.5 and then stopped working when I moved to 2.5.x.  I'm not sure if it matters to you, but doing some bisecting it looks like the behavior changed between 2.2.0 and 2.3.0:

-------------------------
[/cygdrive/d/projects]
$ git --version
git version 2.2.0.dirty

[/cygdrive/d/projects]
$ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files

[/cygdrive/d/projects]
$

-------------------------
[/cygdrive/d/projects]
$ git --version
git version 2.3.0.dirty

[/cygdrive/d/projects]
$ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files
error: could not lock config file d:/projects/git-git/.git/config: No such file or directory

----------------------------

We'll adjust accordingly.

Thanks!

-Matt

----- Original Message ----- 
From: "Adam Dinwoodie" <adam@dinwoodie.org> 
To: cygwin@cygwin.com 
Sent: Thursday, December 3, 2015 1:42:21 PM 
Subject: Re: Git issue. 

On Sun, Nov 22, 2015 at 11:30:27PM +0000, boulderfans wrote: 
> [/cygdrive/d/projects] 
> $ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files 
> error: Unable to open tempfile: /cygdrive/d/projects/d:/projects/git-git/.git/config.lock 
> error: could not lock config file d:/projects/git-git/.git/config: No such file or directory 
> 
> The problem is that the code that is checking the --git-dir option 
> doesn't work properly if you use a DOS drive:/path specification. 

Hi Matt, 

Cygwin applications, including applications you've compiled yourself 
using the Cygwin toolchain, normally expect Cygwin's Linux-like paths, 
e.g. /cygdrive/d/projects/git-git. Attempting to use Windows paths 
simply isn't meant to work. 

You can convert from a Windows path to the equivalent Cygwin path using 
the cygpath utility, e.g.: 

git --git-dir="$(cygpath 'd:/projects/git-git/.git')" config alias.foo ls-files 

Adam 

-- 
Problem reports: http://cygwin.com/problems.html 
FAQ: http://cygwin.com/faq/ 
Documentation: http://cygwin.com/docs.html 
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple 



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git issue.
  2015-12-04  0:07     ` Matt Smith
@ 2015-12-04 17:04       ` Adam Dinwoodie
  0 siblings, 0 replies; 4+ messages in thread
From: Adam Dinwoodie @ 2015-12-04 17:04 UTC (permalink / raw)
  To: cygwin

On Fri, Dec 04, 2015 at 12:07:19AM +0000, Matt Smith wrote:
> > On Sun, Nov 22, 2015 at 11:30:27PM +0000, boulderfans wrote: 
> > > [/cygdrive/d/projects] 
> > > $ git --git-dir=d:/projects/git-git/.git config alias.foo ls-files 
> > > error: Unable to open tempfile: /cygdrive/d/projects/d:/projects/git-git/.git/config.lock 
> > > error: could not lock config file d:/projects/git-git/.git/config: No such file or directory 
> > > 
> > > The problem is that the code that is checking the --git-dir option 
> > > doesn't work properly if you use a DOS drive:/path specification. 
> > 
> > Cygwin applications, including applications you've compiled yourself 
> > using the Cygwin toolchain, normally expect Cygwin's Linux-like paths, 
> > e.g. /cygdrive/d/projects/git-git. Attempting to use Windows paths 
> > simply isn't meant to work. 
> > 
> > You can convert from a Windows path to the equivalent Cygwin path using 
> > the cygpath utility, e.g.: 
> > 
> > git --git-dir="$(cygpath 'd:/projects/git-git/.git')" config alias.foo ls-files 
>
> Ok.  I wasn't sure as the behavior changed.  It worked in 1.9.5 and
> then stopped working when I moved to 2.5.x.  I'm not sure if it
> matters to you, but doing some bisecting it looks like the behavior
> changed between 2.2.0 and 2.3.0:

Please don't top post on this list, and please don't quote raw email
addresses.  See https://cygwin.com/acronyms/#TOFU for a brief note on
the whys.

Out of curiosity, I wrote a short bisect script to test this behaviour;
the behaviour changed in v2.2.0-rc0-1-gfa137f6, which changed handling
of lock files; it looks like it broke your scenario as a side-effect.

However, as I say, this isn't something that was ever supposed to work;
that it did in the past was coincidence rather than design, so I don't
think you'll have any luck getting the old behaviour back.  Using
cygpath to convert between Windows and Cygwin paths, and otherwise
sticking to Linux/Cygwin-style paths for Cygwin applications and
Windows paths for Windows ones, is the correct way to go about this.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-04 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1032375163.9174650.1448234447549.JavaMail.zimbra@comcast.net>
2015-11-22 23:30 ` Git issue boulderfans
2015-12-03 20:42   ` Adam Dinwoodie
2015-12-04  0:07     ` Matt Smith
2015-12-04 17:04       ` Adam Dinwoodie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).