Re: [PATCH v7] ls-files: Add eol diagnostics
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:07:33
Torsten Bögershausen [off-list ref] writes:
When working in a cross-platform environment, a user wants to
check if text files are stored normalized in the repository and if
.gitattributes are set appropriately.
Make it possible to let Git show the line endings in the index and
in the working tree and the effective text/eol attributes.
The end of line ("eolinfo") are shown like this:
"binary" binary file
"text-no-eol" text file without any EOL
"text-lf" text file with LF
"text-crlf" text file with CRLF
"text-crlf-lf" text file with mixed line endings.
The effective text/eol attribute is one of these:
"", "-text", "text", "text=auto", "eol=lf", "eol=crlf"
git ls-files --eol gives an output like this:
i/text-no-eol w/text-no-eol attr/text=auto t/t5100/empty
i/binary w/binary attr/-text t/test-binary-2.png
i/text-lf w/text-lf attr/eol=lf t/t5100/rfc2047-info-0007
i/text-lf w/text-crlf attr/eol=crlf doit.bat
i/text-crlf-lf w/text-crlf-lf attr/ locale/XX.po
Note that the output is meant to be human-readable and may change.Wait, what? I've been assuming that these output being designed was to be read by machine, because this new feature is implemented as a part of the command "ls-files", which is plumbing whose output is meant for script consumption.
+--eol::
+ Show line endings ("eolinfo") and the text/eol attributes ("texteolattr") of files.
+ "eolinfo" is the file content identification used by Git when
+ the "text" attribute is "auto", or core.autocrlf != false.
+
+ "eolinfo" is either "" (when the the info is not available"), or one of "binary",
+ "text-no-eol", "text-lf", "text-crlf" or "text-crlf-lf".
+ The "texteolattr" can be "", "-text", "text", "text=auto", "eol=lf", "eol=crlf".
+
+ Both the content in the index ("i/") and the content in the working tree ("w/")
+ are shown for regular files, followed by the "texteolattr ("attr/").
+Does this format well, or would the second and third paragraph be format in a funny way?