Hi,

I'm still trying to use .gitattributes "text" flag with CRLF line ending files
under Linux.

I'm surprised about the interaction between the index and the working directory,
more specificaly about the interaction between git diff and git status:

  $ git init
  Initialized empty Git repository in /home/ydroneaud/tmp/.git/
  $ echo "test text" > .gitattributes
  $ git add .gitattributes
  $ git commit -m ".gitattributes"
  [master (root-commit) 67c2a06] attrib
   1 file changed, 1 insertion(+)
   create mode 100644 .gitattributes
  $ printf "One\r\nLine\r\n" > test
  $ git add test
  warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory.
  $ git commit -m "test"
  [master 8b06aed] test
  warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory.
   1 file changed, 2 insertions(+)
   create mode 100644 test
  $ git diff
  # <git diff report nothing>
  $ touch test
  $ git diff
  warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory.
  $ git diff                                    # <= twice
  warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory.
  $ git status
  # On branch master
  nothing to commit, working directory clean
  $ git diff
  # <git diff report nothing>


- Why git diff does not always report the CRLF/LF mismatch ?

- Why git status does not report about the CRLF/LF mismatch before updating the index:
  it silently hide the CRLF/LF warning.
git add, git commit report the warning. git status should probably do the same.

Regards.

--
Yann Droneaud
OPTEYA

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to