Re: [PATCH v8] ls-files: Add eol diagnostics
From: Ramsay Jones <hidden>
Date: 2016-06-15 23:07:36
On 30/12/15 12:57, Torsten Bögershausen wrote:
quoted hunk ↗ jump to hunk
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 Add test cases in t0027, thanks to Junio C Hamano for the optimized grep-less sed expression. Helped-By: Eric Sunshine [off-list ref] Signed-off-by: Torsten Bögershausen <redacted> --- Changes since v7: - Remove the "may change" from commit message. - Run make doc, improved git-ls-files.txt Documentation/git-ls-files.txt | 23 +++++++++ builtin/ls-files.c | 19 +++++++ convert.c | 85 +++++++++++++++++++++++++++++++ convert.h | 3 ++ t/t0027-auto-crlf.sh | 112 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 230 insertions(+), 12 deletions(-)diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index e26f01f..13b0e1d 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt@@ -12,6 +12,7 @@ SYNOPSIS 'git ls-files' [-z] [-t] [-v] (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])* (-[c|d|o|i|s|u|k|m])* + [--eol] [-x <pattern>|--exclude=<pattern>] [-X <file>|--exclude-from=<file>] [--exclude-per-directory=<file>]@@ -147,6 +148,19 @@ a space) at the start of each line: possible for manual inspection; the exact format may change at any time. +--eol:: + Show line endings ("eolinfo") and the text/eol attributes ("texteolattr") offiles. + "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".
<bikeshedding> Again, I think this list reads better as: binary, none, lf, crlf and mixed. If you prefer to have 'text' in there somewhere, how about: binary, text-none, text-lf, text-crlf, text-mixed. :-D (I promise not the mention it again!) </bikeshedding> ATB, Ramsay Jones