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

Re: core.autocrlf & Cygwin - files incorrectly flagged as modified

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Dec 17, 2009, 01:05 UTC
Message-ID
<be6fef0d0912161705q1ef23634rccdc170d69cf9484@mail.gmail.com>
In-Reply-To
<loom.20091215T225528-115@post.gmane.org>
Hi,
On Wed, Dec 16, 2009 at 6:24 AM, David Antliff <david.antliff@gmail.com> wrote:
> I suspect what is happening is that the line conversion routine in git might be
> stripping trailing whitespace, as well as converting the line endings. This
> operation is not properly accounted for in the reverse direction, and the file
> is flagged as modified.
I am not a Git expert, but could it be your editor on Windows?

Not just stripping whitespace; it might be setting the eol to LF (instead of CRLF) when saving the file.

Show 5 quoted lines
> Also, as cloned files are converted to DOS-line-endings, by default Cygwin's
> bash cannot run any scripts as they have the wrong line endings. I have to set
> the 'permanent' bash variable SHELLOPTS to include 'igncr' before bash scripts
> can run. Perhaps this is wrong and git on Cygwin (with binary mounts) should be
> converting to UNIX line endings instead?

Again, IANAGE, but according to the manual, this should be expected, because Git, when writing to the filesystem, converts LF to CRLF:

  If true, makes git convert CRLF at the end of lines in text files to
  LF when reading from the filesystem, and convert in reverse when
  writing to the filesystem.
> At one point I tried switching off core.autocrlf for myself but this caused a
> lot of conflicts due to mismatched line-endings. It seems to me that if we want
> to switch to this, *everyone* has to do it at once.

Just make this conversion a commit, and depending on your project's workflow, push/pull it.

Although the whole file will be marked as changed, you can always double-check that only whitespace changes have been made by running git-diff with --ignore-space-at-eol or -b.

-- 
Cheers,
Ray Chuan
Previous: David AntliffNext: David Antliff
Message 2 of 6 in “core.autocrlf & Cygwin - files incorrectly flagged as modified”
  1. David AntliffDec 15, 2009
  2. Tay Ray ChuanDec 17, 2009
  3. David AntliffDec 17, 2009
  4. Robin RosenbergDec 17, 2009
  5. David AntliffDec 18, 2009
  6. Robin RosenbergDec 18, 2009

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.