From: Sebastian Schuberth Date: Tue, 07 Aug 2007 15:27:22 GMT Subject: Re: git on Cygwin: Not a valid object name HEAD Message-ID: <46B88F5A.9040801@gmail.com> In-Reply-To: <20070807145825.GO21692@lavos.net> >> Now on a normal UNIX system open(2) *always* by definition does >> binary IO. But Cygwin's text mount option tries to make UNIX >> programs DOS-friendly by making all files treated as text, even if >> it supposedly doing binary IO via open(2). >> >> I think its a mis-feature of Cygwin. Git has no way (that I know >> of) to defend itself from this, other than to tell the user to make >> sure they only store a Git repository in a location that is mounted >> with the binary flag. > > Cygwin, like Windows' own open(2) simulation, defines an O_BINARY to pass > as a flag to open(2). I once got Git half-working on Cygwin text-mode > mounts by doing a horrible hack approximating: > > #define open(name, flag, ...) \ > open(name, (flag) | O_BINARY, ## __VA_ARGS__) > > But it only half worked. Eventually it managed to corrupt itself again, > and worse, the test suite was completely hopeless, as all shell activity > still results in text-mode files. Something like that would have been my suggested work-around, too. Unfortunate to hear this alone won't fix the problem. I've spotted several fopen() calls in git where "b" is not explicitly used. Maybe fixing those, too, would to do it. -- Sebastian Schuberth