git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git on Cygwin: Not a valid object name HEAD

From
Steffen Prohaska <prohaska@zib.de>
Date
Aug 8, 2007, 05:46 UTC
Message-ID
<11631546-D4E4-491A-8A12-98A42043C535@zib.de>
In-Reply-To
<20070808042513.GP21692@lavos.net>
On Aug 8, 2007, at 6:25 AM, Brian Downing wrote:
Show 17 quoted lines
> On Wed, Aug 08, 2007 at 12:46:49AM +0200, Steffen Prohaska wrote:
>> I started to run the tests on cygwin in textmode. I chose the
>> following setup.
>
> In addition to all the other stuff discussed, I believe you also need
> to worry about the binaryness of stdin and stdout.
>
> Looking at:
>
> http://www.cygwin.com/cygwin-ug-net/using-textbinary.html
>
> I think this can be achieved by putting something like:
>
> 	setmode(0, O_BINARY);
> 	setmode(1, O_BINARY);
>
> at the start of git's main().
I agree. This is my understanding as well.
Show 5 quoted lines
> When I was trying to get this to work, I did this as well as fixing up
> open() and fopen() calls as has already been discussed.  What got me
> to quit, however, was that I never found a decent way to make the Git
> shell scripts binary safe, and enough of the system was in shell as to
> make it pretty much useless for everyday use.
Did you find a way, maybe not as decent as you wished?
Show 26 quoted lines
> Looking at the examples on the above page:
>
>     To illustrate the various rules, we provide scripts to delete  
> CRs from
>     files by using the tr program, which can only write to standard  
> output.
>     The script
>
>     #!/bin/sh
>     # Remove \r from the file given as argument
>     tr -d '\r' < "$1" > "$1".nocr
>
>     will not work on a text mounted systems because the \r will be
>     reintroduced on writing. However scripts such as
>
>     #!/bin/sh
>     # Remove \r from the file given as argument
>     tr -d '\r' | gzip | gunzip > "$1".nocr
>
>     work fine. In the first case (assuming the pipes are binary) we  
> rely
>     on gunzip to set its output to binary mode, possibly overriding  
> the
>     mode used by the shell.
>
> was all it took to convince me this was probably a fool's errand.

Yeah, it looks quite crazy. I started to search for an option that would force the shell to provide redirection in binary mode, overriding the standard rules. I found the igncr option [1], which is not what I need. But apparently there have been some efforts to deal with line endings in bash beyond the cygwin standard rules. Maybe there's a useful option that I haven't found yet.

[1] http://cygwin.com/ml/cygwin-announce/2007-01/msg00015.html
> I wound up fixing our software so it would build on a binary mount,
> which I decided was a much more sane solution.

Well, our software already builds and I was not even aware that there is a problem with git on cygwin until I asked more people to test it. I naively chose the default option because I didn't have a reason to do otherwise. But apparently there is an option, and people use this option.

My fear is that the first impression of git is too bad on Windows if it can't handle textmode. I can't recommend it. People will make me responsible for recommending them a tool that only cause troubles or forces them to reconfigure their cygwin, which worked for them for years. I even remember that we had a policy to explicitly set cygwin to textmode to avoid problems with cvs commits in combination with Visual Studio 6.

	Steffen
Previous: Brian DowningNext: Junio C Hamano
Message 21 of 60 in “git on Cygwin: Not a valid object name HEAD”
  1. Sebastian SchuberthAug 7, 2007
  2. Johannes SchindelinAug 7, 2007
  3. Sebastian SchuberthAug 7, 2007
  4. Sebastian SchuberthAug 7, 2007
  5. Shawn O. PearceAug 7, 2007
  6. Brian DowningAug 7, 2007
  7. Sebastian SchuberthAug 7, 2007
  8. Steffen ProhaskaAug 7, 2007
  9. Mark LevedahlAug 7, 2007
  10. Steffen ProhaskaAug 7, 2007
  11. Linus TorvaldsAug 7, 2007
  12. Junio C HamanoAug 7, 2007
  13. Linus TorvaldsAug 8, 2007
  14. Steffen ProhaskaAug 7, 2007
  15. cygwin: added fopen "b" and open O_BINARY to support cygwin's textmodeSteffen Prohaska, Aug 7, 2007
  16. tests: added d2u to have unix style testfiles even in textmodeSteffen Prohaska, Aug 7, 2007
  17. Linus TorvaldsAug 8, 2007
  18. Steffen ProhaskaAug 8, 2007
  19. Steffen ProhaskaAug 7, 2007
  20. Brian DowningAug 8, 2007
  21. Steffen ProhaskaAug 8, 2007
  22. Junio C HamanoAug 7, 2007
  23. Sebastian SchuberthAug 8, 2007
  24. Mark LevedahlAug 8, 2007
  25. Steffen ProhaskaAug 8, 2007
  26. Mark LevedahlAug 8, 2007
  27. Johannes SchindelinAug 8, 2007
  28. Steffen ProhaskaAug 8, 2007
  29. Steffen ProhaskaAug 8, 2007
  30. Steffen ProhaskaAug 8, 2007
  31. Mark LevedahlAug 8, 2007
  32. Steffen ProhaskaAug 9, 2007
  33. Marius Storm-OlsenAug 9, 2007
  34. Steffen ProhaskaAug 9, 2007
  35. Marius Storm-OlsenAug 9, 2007
  36. Johannes SchindelinAug 9, 2007
  37. Marius Storm-OlsenAug 9, 2007
  38. Steffen ProhaskaAug 9, 2007
  39. Johannes SchindelinAug 8, 2007
  40. Steffen ProhaskaAug 9, 2007
  41. Torgil SvenssonAug 10, 2007
  42. Steffen ProhaskaAug 10, 2007
  43. Johannes SchindelinAug 10, 2007
  44. Steffen ProhaskaAug 10, 2007
  45. Torgil SvenssonAug 10, 2007
  46. Steffen ProhaskaAug 11, 2007
  47. Johannes SchindelinAug 13, 2007
  48. Torgil SvenssonAug 15, 2007
  49. Steffen ProhaskaAug 15, 2007
  50. David KastrupAug 15, 2007
  51. Steffen ProhaskaAug 15, 2007
  52. David KastrupAug 15, 2007
  53. Mark LevedahlAug 7, 2007
  54. Shawn O. PearceAug 15, 2007
  55. Mark LevedahlAug 15, 2007
  56. Mark LevedahlAug 15, 2007
  57. Steffen ProhaskaAug 15, 2007
  58. Mark LevedahlAug 16, 2007
  59. Steffen ProhaskaAug 16, 2007
  60. Mark LevedahlAug 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.