{"thread":{"id":"40956","subject":"[PATCH v7] ls-files: Add eol diagnostics","startedAt":"2015-12-07T17:09:13Z","lastAt":"2015-12-07T20:21:20Z","messageCount":3,"participants":["Torsten Bögershausen","Philip Oakley","Eric Sunshine"],"isPatch":true,"patchVersion":7,"patchTotal":null},"messages":[{"id":"274116","messageId":"5665BD39.1040403@web.de","threadId":"40956","inReplyTo":null,"subject":"[PATCH v7] ls-files: Add eol diagnostics","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2015-12-07T17:09:13Z","receivedAt":"2015-12-07T17:09:13Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"When working in a cross-platform environment, a user wants to\ncheck if text files are stored normalized in the repository and if\n.gitattributes are set appropriately.\n\nMake it possible to let Git show the line endings in the index and\nin the working tree and the effective text/eol attributes.\n\nThe end of line (\"eolinfo\") are shown like this:\n\"binary\"       binary file\n\"text-no-eol\"  text file without any EOL\n\"text-lf\"      text file with LF\n\"text-crlf\"    text file with CRLF\n\"text-crlf-lf\" text file with mixed line endings.\n\nThe effective text/eol attribute is one of these:\n\"\", \"-text\", \"text\", \"text=auto\", \"eol=lf\", \"eol=crlf\"\n\ngit ls-files --eol gives an output like this:\n\ni/text-no-eol   w/text-no-eol   attr/text=auto t/t5100/empty\ni/binary        w/binary        attr/-text     t/test-binary-2.png\ni/text-lf       w/text-lf       attr/eol=lf    t/t5100/rfc2047-info-0007\ni/text-lf       w/text-crlf     attr/eol=crlf  doit.bat\ni/text-crlf-lf  w/text-crlf-lf  attr/          locale/XX.po\n\nNote that the output is meant to be human-readable and may change.\n\nHelped-By: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\nChanges since v6:\n- Fixed potential memory leak in convert.c, when strbuf_read_file()\n  fails.\n- t0027:\n  Cleanups (empty lines, egrep, un-needed quoting)\n  test_when_finished 'rm e expect actual' \n  There doesn't seem to be 100% consistency when and how to remove files.\n  (I think if we create files, we should be able to remove them:\n  use \"rm\" rather than \"rm -f\")\n  Add comment about the \"last test case\", which removes file to run\n  'git ls-files -d\"\n\n Documentation/git-ls-files.txt |  22 +++++++++\n builtin/ls-files.c             |  19 ++++++++\n convert.c                      |  85 ++++++++++++++++++++++++++++++++\n convert.h                      |   3 ++\n t/t0027-auto-crlf.sh           | 108 ++++++++++++++++++++++++++++++++++++-----\n 5 files changed, 226 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\nindex e26f01f..8f29c99 100644\n--- a/Documentation/git-ls-files.txt\n+++ b/Documentation/git-ls-files.txt\n@@ -12,6 +12,7 @@ SYNOPSIS\n 'git ls-files' [-z] [-t] [-v]\n \t\t(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*\n \t\t(-[c|d|o|i|s|u|k|m])*\n+\t\t[--eol]\n \t\t[-x <pattern>|--exclude=<pattern>]\n \t\t[-X <file>|--exclude-from=<file>]\n \t\t[--exclude-per-directory=<file>]\n@@ -147,6 +148,18 @@ a space) at the start of each line:\n \tpossible for manual inspection; the exact format may change at\n \tany time.\n \n+--eol::\n+\tShow line endings (\"eolinfo\") and the text/eol attributes (\"texteolattr\") of files.\n+\t\"eolinfo\" is the file content identification used by Git when\n+\tthe \"text\" attribute is \"auto\", or core.autocrlf != false.\n+\n+\t\"eolinfo\" is either \"\" (when the the info is not available\"), or one of \"binary\",\n+\t\"text-no-eol\", \"text-lf\", \"text-crlf\" or \"text-crlf-lf\".\n+\tThe \"texteolattr\" can be \"\", \"-text\", \"text\", \"text=auto\", \"eol=lf\", \"eol=crlf\".\n+\n+\tBoth the content in the index (\"i/\") and the content in the working tree (\"w/\")\n+\tare shown for regular files, followed by the \"texteolattr (\"attr/\").\n+\n \\--::\n \tDo not interpret any more arguments as options.\n \n@@ -161,6 +174,15 @@ which case it outputs:\n \n         [<tag> ]<mode> <object> <stage> <file>\n \n+'git ls-files --eol' will show\n+\ti/<eolinfo> w/<eolinfo> attr/<eolattr> <file>\n+\n+'git ls-files --eol -o' will show\n+\ti/          w/<eolinfo> attr/<eolattr> <file>\n+\n+'git ls-files --eol -s' will show\n+[<tag> ]<mode> <object> <stage> i/<eolinfo> w/<eolinfo> attr/<eolattr> <file>\n+\n 'git ls-files --unmerged' and 'git ls-files --stage' can be used to examine\n detailed information on unmerged paths.\n \ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex b6a7cb0..ef892bc 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -27,6 +27,7 @@ static int show_killed;\n static int show_valid_bit;\n static int line_terminator = '\\n';\n static int debug_mode;\n+static int show_eol;\n \n static const char *prefix;\n static int max_prefix_len;\n@@ -47,6 +48,21 @@ static const char *tag_modified = \"\";\n static const char *tag_skip_worktree = \"\";\n static const char *tag_resolve_undo = \"\";\n \n+static void write_eolinfo(const struct cache_entry *ce, const char *path)\n+{\n+\tstruct stat st;\n+\tconst char *i_txt = \"\";\n+\tconst char *w_txt = \"\";\n+\tif (!show_eol)\n+\t\treturn;\n+\tif (ce && S_ISREG(ce->ce_mode))\n+\t\ti_txt = get_cached_convert_stats_ascii(ce->name);\n+\tif (!lstat(path, &st) && (S_ISREG(st.st_mode)))\n+\t\tw_txt = get_wt_convert_stats_ascii(path);\n+\tprintf(\"i/%-13s w/%-13s attr/%-9s \", i_txt, w_txt,\n+\t\t\t\t get_convert_attr_ascii(path));\n+}\n+\n static void write_name(const char *name)\n {\n \t/*\n@@ -68,6 +84,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)\n \t\treturn;\n \n \tfputs(tag, stdout);\n+\twrite_eolinfo(NULL, ent->name);\n \twrite_name(ent->name);\n }\n \n@@ -170,6 +187,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)\n \t\t       find_unique_abbrev(ce->sha1,abbrev),\n \t\t       ce_stage(ce));\n \t}\n+\twrite_eolinfo(ce, ce->name);\n \twrite_name(ce->name);\n \tif (debug_mode) {\n \t\tconst struct stat_data *sd = &ce->ce_stat_data;\n@@ -433,6 +451,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)\n \t\tOPT_BIT(0, \"directory\", &dir.flags,\n \t\t\tN_(\"show 'other' directories' names only\"),\n \t\t\tDIR_SHOW_OTHER_DIRECTORIES),\n+\t\tOPT_BOOL(0, \"eol\", &show_eol, N_(\"show line endings of files\")),\n \t\tOPT_NEGBIT(0, \"empty-directory\", &dir.flags,\n \t\t\tN_(\"don't show empty directories\"),\n \t\t\tDIR_HIDE_EMPTY_DIRECTORIES),\ndiff --git a/convert.c b/convert.c\nindex 814e814..61d6757 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -13,6 +13,11 @@\n  * translation when the \"text\" attribute or \"auto_crlf\" option is set.\n  */\n \n+/* Stat bits: When BIN is set, the txt bits are unset */\n+#define CONVERT_STAT_BITS_TXT_LF   (1)\n+#define CONVERT_STAT_BITS_TXT_CRLF (2)\n+#define CONVERT_STAT_BITS_BIN      (4)\n+\n enum crlf_action {\n \tCRLF_GUESS = -1,\n \tCRLF_BINARY = 0,\n@@ -95,6 +100,62 @@ static int is_binary(unsigned long size, struct text_stat *stats)\n \treturn 0;\n }\n \n+static unsigned int gather_convert_stats(const char *data, unsigned long size)\n+{\n+\tstruct text_stat stats;\n+\tif (!data || !size)\n+\t\treturn 0;\n+\tgather_stats(data, size, &stats);\n+\tif (is_binary(size, &stats) || stats.cr != stats.crlf)\n+\t\treturn CONVERT_STAT_BITS_BIN;\n+\telse if (stats.crlf && (stats.crlf == stats.lf))\n+\t\treturn CONVERT_STAT_BITS_TXT_CRLF;\n+\telse if (stats.crlf && stats.lf)\n+\t\treturn CONVERT_STAT_BITS_TXT_CRLF | CONVERT_STAT_BITS_TXT_LF;\n+\telse if (stats.lf)\n+\t\treturn CONVERT_STAT_BITS_TXT_LF;\n+\telse\n+\t\treturn 0;\n+}\n+\n+static const char *gather_convert_stats_ascii(const char *data, unsigned long size)\n+{\n+\tunsigned int convert_stats = gather_convert_stats(data, size);\n+\n+\tif (convert_stats & CONVERT_STAT_BITS_BIN)\n+\t\treturn \"binary\";\n+\tswitch (convert_stats) {\n+\t\tcase CONVERT_STAT_BITS_TXT_LF:\n+\t\t\treturn(\"text-lf\");\n+\t\tcase CONVERT_STAT_BITS_TXT_CRLF:\n+\t\t\treturn(\"text-crlf\");\n+\t\tcase CONVERT_STAT_BITS_TXT_LF | CONVERT_STAT_BITS_TXT_CRLF:\n+\t\t\treturn(\"text-crlf-lf\");\n+\t\tdefault:\n+\t\t\treturn (\"text-no-eol\");\n+\t}\n+}\n+\n+const char *get_cached_convert_stats_ascii(const char *path)\n+{\n+\tconst char *ret;\n+\tunsigned long sz;\n+\tvoid *data = read_blob_data_from_cache(path, &sz);\n+\tret = gather_convert_stats_ascii(data, sz);\n+\tfree(data);\n+\treturn ret;\n+}\n+\n+const char *get_wt_convert_stats_ascii(const char *path)\n+{\n+\tconst char *ret = \"\";\n+\tstruct strbuf sb = STRBUF_INIT;\n+\tif (strbuf_read_file(&sb, path, 0) >= 0)\n+\t\tret = gather_convert_stats_ascii(sb.buf, sb.len);\n+\tstrbuf_release(&sb);\n+\treturn ret;\n+}\n+\n static enum eol output_eol(enum crlf_action crlf_action)\n {\n \tswitch (crlf_action) {\n@@ -777,6 +838,30 @@ int would_convert_to_git_filter_fd(const char *path)\n \treturn apply_filter(path, NULL, 0, -1, NULL, ca.drv->clean);\n }\n \n+const char *get_convert_attr_ascii(const char *path)\n+{\n+\tstruct conv_attrs ca;\n+\tenum crlf_action crlf_action;\n+\n+\tconvert_attrs(&ca, path);\n+\tcrlf_action = input_crlf_action(ca.crlf_action, ca.eol_attr);\n+\tswitch (crlf_action) {\n+\t\tcase CRLF_GUESS:\n+\t\t\treturn \"\";\n+\t\tcase CRLF_BINARY:\n+\t\t\treturn \"-text\";\n+\t\tcase CRLF_TEXT:\n+\t\t\treturn \"text\";\n+\t\tcase CRLF_INPUT:\n+\t\t\treturn \"eol=lf\";\n+\t\tcase CRLF_CRLF:\n+\t\t\treturn \"eol=crlf\";\n+\t\tcase CRLF_AUTO:\n+\t\t\treturn \"text=auto\";\n+\t}\n+\treturn \"\";\n+}\n+\n int convert_to_git(const char *path, const char *src, size_t len,\n                    struct strbuf *dst, enum safe_crlf checksafe)\n {\ndiff --git a/convert.h b/convert.h\nindex d9d853c..ccf436b 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -32,6 +32,9 @@ enum eol {\n };\n \n extern enum eol core_eol;\n+extern const char *get_cached_convert_stats_ascii(const char *path);\n+extern const char *get_wt_convert_stats_ascii(const char *path);\n+extern const char *get_convert_attr_ascii(const char *path);\n \n /* returns 1 if *dst was used */\n extern int convert_to_git(const char *path, const char *src, size_t len,\ndiff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh\nindex b343651..a89f2ba 100755\n--- a/t/t0027-auto-crlf.sh\n+++ b/t/t0027-auto-crlf.sh\n@@ -56,21 +56,16 @@ create_gitattributes () {\n }\n \n create_NNO_files () {\n-\tlfname=$1\n-\tcrlfname=$2\n-\tlfmixcrlf=$3\n-\tlfmixcr=$4\n-\tcrlfnul=$5\n \tfor crlf in false true input\n \tdo\n \t\tfor attr in \"\" auto text -text lf crlf\n \t\tdo\n \t\t\tpfx=NNO_${crlf}_attr_${attr} &&\n-\t\t\tcp $lfname    ${pfx}_LF.txt &&\n-\t\t\tcp $crlfname  ${pfx}_CRLF.txt &&\n-\t\t\tcp $lfmixcrlf ${pfx}_CRLF_mix_LF.txt &&\n-\t\t\tcp $lfmixcr   ${pfx}_LF_mix_CR.txt &&\n-\t\t\tcp $crlfnul   ${pfx}_CRLF_nul.txt\n+\t\t\tcp CRLF_mix_LF ${pfx}_LF.txt &&\n+\t\t\tcp CRLF_mix_LF ${pfx}_CRLF.txt &&\n+\t\t\tcp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&\n+\t\t\tcp CRLF_mix_LF ${pfx}_LF_mix_CR.txt &&\n+\t\t\tcp CRLF_mix_LF ${pfx}_CRLF_nul.txt\n \t\tdone\n \tdone\n }\n@@ -96,7 +91,7 @@ commit_check_warn () {\n \tcrlfnul=$7\n \tpfx=crlf_${crlf}_attr_${attr}\n \tcreate_gitattributes \"$attr\" &&\n-\tfor f in LF CRLF repoMIX LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul\n+\tfor f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul\n \tdo\n \t\tfname=${pfx}_$f.txt &&\n \t\tcp $f $fname &&\n@@ -149,6 +144,36 @@ commit_chk_wrnNNO () {\n \t'\n }\n \n+stats_ascii () {\n+\tcase \"$1\" in\n+\t\tLF)\n+\t\techo text-lf\n+\t\t;;\n+\t\tCRLF)\n+\t\techo text-crlf\n+\t\t;;\n+\t\tCRLF_mix_LF)\n+\t\techo text-crlf-lf\n+\t\t;;\n+\t\tLF_mix_CR)\n+\t\techo binary\n+\t\t;;\n+\t\tCRLF_nul)\n+\t\techo binary\n+\t\t;;\n+\t\tLF_nul)\n+\t\techo binary\n+\t\t;;\n+\t\tCRLF_mix_CR)\n+\t\techo binary\n+\t\t;;\n+\t\t*)\n+\t\techo error_invalid $1\n+\t\t;;\n+\tesac\n+\n+}\n+\n check_files_in_repo () {\n \tcrlf=$1\n \tattr=$2\n@@ -214,6 +239,20 @@ checkout_files () {\n \t\tfi\n \tdone\n \n+\ttest_expect_success \"ls-files --eol $lfname ${pfx}LF.txt\" \"\n+\t  test_when_finished 'rm e expect actual' &&\n+\t\tcat >e <<-EOF &&\n+\t\ti/text-crlf w/$(stats_ascii $crlfname) ${src}CRLF.txt\n+\t\ti/text-crlf-lf w/$(stats_ascii $lfmixcrlf) ${src}CRLF_mix_LF.txt\n+\t\ti/text-lf w/$(stats_ascii $lfname) ${src}LF.txt\n+\t\ti/binary w/$(stats_ascii $lfmixcr) ${src}LF_mix_CR.txt\n+\t\ti/binary w/$(stats_ascii $crlfnul) ${src}CRLF_nul.txt\n+\t\ti/binary w/$(stats_ascii $crlfnul) ${src}LF_nul.txt\n+\t\tEOF\n+\t\tsort <e >expect &&\n+\t\tgit ls-files --eol $src* | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&\n+\t\ttest_cmp expect actual\n+\t\"\n \ttest_expect_success \"checkout core.eol=$eol core.autocrlf=$crlf gitattributes=$attr file=LF\" \"\n \t\tcompare_ws_file $pfx $lfname    ${src}LF.txt\n \t\"\n@@ -231,6 +270,37 @@ checkout_files () {\n \t\"\n }\n \n+# Test control characters\n+# NUL SOH CR EOF==^Z\n+test_expect_success 'ls-files --eol -o Text/Binary' '\n+\ttest_when_finished \"rm e expect actual TeBi_*\" &&\n+\tSTRT=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA &&\n+\tSTR=$STRT$STRT$STRT$STRT &&\n+\tprintf \"${STR}BBB\\001\" >TeBi_127_S &&\n+\tprintf \"${STR}BBBB\\001\">TeBi_128_S &&\n+\tprintf \"${STR}BBB\\032\" >TeBi_127_E &&\n+\tprintf \"\\032${STR}BBB\" >TeBi_E_127 &&\n+\tprintf \"${STR}BBBB\\000\">TeBi_128_N &&\n+\tprintf \"${STR}BBB\\012\">TeBi_128_L &&\n+\tprintf \"${STR}BBB\\015\">TeBi_127_C &&\n+\tprintf \"${STR}BB\\015\\012\" >TeBi_126_CL &&\n+\tprintf \"${STR}BB\\015\\012\\015\" >TeBi_126_CLC &&\n+\tcat >e <<-\\EOF &&\n+\ti/ w/binary TeBi_127_S\n+\ti/ w/text-no-eol TeBi_128_S\n+\ti/ w/text-no-eol TeBi_127_E\n+\ti/ w/binary TeBi_E_127\n+\ti/ w/binary TeBi_128_N\n+\ti/ w/text-lf TeBi_128_L\n+\ti/ w/binary TeBi_127_C\n+\ti/ w/text-crlf TeBi_126_CL\n+\ti/ w/binary TeBi_126_CLC\n+\tEOF\n+\tsort <e >expect &&\n+\tgit ls-files --eol -o | grep TeBi_ | sed -e 's!attr/[=a-z-]*!!g' -e \"s/  */ /g\" | sort >actual &&\n+\ttest_cmp expect actual\n+'\n+\n #######\n test_expect_success 'setup master' '\n \techo >.gitattributes &&\n@@ -480,4 +550,20 @@ checkout_files    native  true  \"lf\"      LF    CRLF  CRLF_mix_LF  LF_mix_CR\n checkout_files    native  false \"crlf\"    CRLF  CRLF  CRLF         CRLF_mix_CR  CRLF_nul\n checkout_files    native  true  \"crlf\"    CRLF  CRLF  CRLF         CRLF_mix_CR  CRLF_nul\n \n+\n+# Should be the last test case: remove some files from the worktree\n+# run 'git ls-files -d'\n+test_expect_success 'ls-files --eol -d' \"\n+\trm  crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt crlf_false_attr__LF.txt .gitattributes &&\n+\tcat >expect <<-\\EOF &&\n+\ti/text-crlf w/ crlf_false_attr__CRLF.txt\n+\ti/text-crlf-lf w/ crlf_false_attr__CRLF_mix_LF.txt\n+\ti/text-lf w/ .gitattributes\n+\ti/text-lf w/ crlf_false_attr__LF.txt\n+\tEOF\n+\tgit ls-files --eol -d | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&\n+\ttest_cmp expect actual &&\n+\trm expect actual\n+\"\n+\n test_done\n-- \n2.6.2.403.gd7a84e3\n"},{"id":"274131","messageId":"E2D76919B3F548E9864D12425A4C0EF6@PhilipOakley","threadId":"40956","inReplyTo":"5665BD39.1040403@web.de","subject":"Re: [PATCH v7] ls-files: Add eol diagnostics","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2015-12-07T19:57:55Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Torsten Bögershausen\" <tboegi@web.de>\n> When working in a cross-platform environment, a user wants to\n> check if text files are stored normalized in the repository and if\n> .gitattributes are set appropriately.\n>\n\nThe need for this came up again on the Git Users list \n(https://groups.google.com/d/msg/git-users/jC-mngwVYo4/Sr4JXgpGJVYJ). It \nwill definitely be useful in mixed environments wher users can get rather \nconfused.\n\nI've added a couple of bikeshed comments on some of the wider issues this \nbumps into.\n\n> Make it possible to let Git show the line endings in the index and\n> in the working tree and the effective text/eol attributes.\n>\n> The end of line (\"eolinfo\") are shown like this:\n> \"binary\"       binary file\n> \"text-no-eol\"  text file without any EOL\n> \"text-lf\"      text file with LF\n> \"text-crlf\"    text file with CRLF\n> \"text-crlf-lf\" text file with mixed line endings.\n\n<bikeshed> This \"text-crlf-lf\" can easily occur for eol=crlf files which \nhave merge conflict markers, which are always eol=lf. It may be that the \nconflict markers should use the eol setting that is in place for the file \nbeing merged. e.g. \nhttp://stackoverflow.com/questions/17832616/make-git-use-crlf-on-its-head-merge-lines \n(which links to https://github.com/git/git/blob/master/xdiff/xmerge.c#L173, \nand 3 other places in fill_conflict_hunk). The issue of how to mark EOL \nconflicts in-text is tricky as it's a non-obvious white space issue - it \ndoesn't fit well with the normal >>> === <<< conflict markers.\n\n>\n> The effective text/eol attribute is one of these:\n> \"\", \"-text\", \"text\", \"text=auto\", \"eol=lf\", \"eol=crlf\"\n\n<bikeshed> the \"-text\" attribute isn't explained in the gitattributes(5) \npage, except by implication  from one of the examples.\n>\n> git ls-files --eol gives an output like this:\n>\n> i/text-no-eol   w/text-no-eol   attr/text=auto t/t5100/empty\n> i/binary        w/binary        attr/-text     t/test-binary-2.png\n> i/text-lf       w/text-lf       attr/eol=lf    t/t5100/rfc2047-info-0007\n> i/text-lf       w/text-crlf     attr/eol=crlf  doit.bat\n> i/text-crlf-lf  w/text-crlf-lf  attr/          locale/XX.po\n>\n> Note that the output is meant to be human-readable and may change.\n>\n> Helped-By: Eric Sunshine <sunshine@sunshineco.com>\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n> Changes since v6:\n> - Fixed potential memory leak in convert.c, when strbuf_read_file()\n>  fails.\n> - t0027:\n>  Cleanups (empty lines, egrep, un-needed quoting)\n>  test_when_finished 'rm e expect actual'\n>  There doesn't seem to be 100% consistency when and how to remove files.\n>  (I think if we create files, we should be able to remove them:\n>  use \"rm\" rather than \"rm -f\")\n>  Add comment about the \"last test case\", which removes file to run\n>  'git ls-files -d\"\n>\n> Documentation/git-ls-files.txt |  22 +++++++++\n> builtin/ls-files.c             |  19 ++++++++\n> convert.c                      |  85 ++++++++++++++++++++++++++++++++\n> convert.h                      |   3 ++\n> t/t0027-auto-crlf.sh           | 108 \n> ++++++++++++++++++++++++++++++++++++-----\n> 5 files changed, 226 insertions(+), 11 deletions(-)\n>\n> diff --git a/Documentation/git-ls-files.txt \n> b/Documentation/git-ls-files.txt\n> index e26f01f..8f29c99 100644\n> --- a/Documentation/git-ls-files.txt\n> +++ b/Documentation/git-ls-files.txt\n> @@ -12,6 +12,7 @@ SYNOPSIS\n> 'git ls-files' [-z] [-t] [-v]\n>  (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*\n>  (-[c|d|o|i|s|u|k|m])*\n> + [--eol]\n>  [-x <pattern>|--exclude=<pattern>]\n>  [-X <file>|--exclude-from=<file>]\n>  [--exclude-per-directory=<file>]\n> @@ -147,6 +148,18 @@ a space) at the start of each line:\n>  possible for manual inspection; the exact format may change at\n>  any time.\n>\n> +--eol::\n> + Show line endings (\"eolinfo\") and the text/eol attributes \n> (\"texteolattr\") of files.\n> + \"eolinfo\" is the file content identification used by Git when\n> + the \"text\" attribute is \"auto\", or core.autocrlf != false.\n> +\n> + \"eolinfo\" is either \"\" (when the the info is not available\"), or one of \n> \"binary\",\n> + \"text-no-eol\", \"text-lf\", \"text-crlf\" or \"text-crlf-lf\".\n> + The \"texteolattr\" can be \"\", \"-text\", \"text\", \"text=auto\", \"eol=lf\", \n> \"eol=crlf\".\n\nperhaps add  'see also linkgit:gitattributes[5] .' though it may be too \ntangential.\n\n> +\n> + Both the content in the index (\"i/\") and the content in the working tree \n> (\"w/\")\n> + are shown for regular files, followed by the \"texteolattr (\"attr/\").\n> +\n> \\--::\n>  Do not interpret any more arguments as options.\n>\n> @@ -161,6 +174,15 @@ which case it outputs:\n>\n>         [<tag> ]<mode> <object> <stage> <file>\n>\n> +'git ls-files --eol' will show\n> + i/<eolinfo> w/<eolinfo> attr/<eolattr> <file>\n> +\n> +'git ls-files --eol -o' will show\n> + i/          w/<eolinfo> attr/<eolattr> <file>\n> +\n> +'git ls-files --eol -s' will show\n> +[<tag> ]<mode> <object> <stage> i/<eolinfo> w/<eolinfo> attr/<eolattr> \n> <file>\n> +\n> 'git ls-files --unmerged' and 'git ls-files --stage' can be used to \n> examine\n> detailed information on unmerged paths.\n>\n> diff --git a/builtin/ls-files.c b/builtin/ls-files.c\n> index b6a7cb0..ef892bc 100644\n> --- a/builtin/ls-files.c\n> +++ b/builtin/ls-files.c\n> @@ -27,6 +27,7 @@ static int show_killed;\n> static int show_valid_bit;\n> static int line_terminator = '\\n';\n> static int debug_mode;\n> +static int show_eol;\n>\n> static const char *prefix;\n> static int max_prefix_len;\n> @@ -47,6 +48,21 @@ static const char *tag_modified = \"\";\n> static const char *tag_skip_worktree = \"\";\n> static const char *tag_resolve_undo = \"\";\n>\n> +static void write_eolinfo(const struct cache_entry *ce, const char *path)\n> +{\n> + struct stat st;\n> + const char *i_txt = \"\";\n> + const char *w_txt = \"\";\n> + if (!show_eol)\n> + return;\n> + if (ce && S_ISREG(ce->ce_mode))\n> + i_txt = get_cached_convert_stats_ascii(ce->name);\n> + if (!lstat(path, &st) && (S_ISREG(st.st_mode)))\n> + w_txt = get_wt_convert_stats_ascii(path);\n> + printf(\"i/%-13s w/%-13s attr/%-9s \", i_txt, w_txt,\n> + get_convert_attr_ascii(path));\n> +}\n> +\n> static void write_name(const char *name)\n> {\n>  /*\n> @@ -68,6 +84,7 @@ static void show_dir_entry(const char *tag, struct \n> dir_entry *ent)\n>  return;\n>\n>  fputs(tag, stdout);\n> + write_eolinfo(NULL, ent->name);\n>  write_name(ent->name);\n> }\n>\n> @@ -170,6 +187,7 @@ static void show_ce_entry(const char *tag, const \n> struct cache_entry *ce)\n>         find_unique_abbrev(ce->sha1,abbrev),\n>         ce_stage(ce));\n>  }\n> + write_eolinfo(ce, ce->name);\n>  write_name(ce->name);\n>  if (debug_mode) {\n>  const struct stat_data *sd = &ce->ce_stat_data;\n> @@ -433,6 +451,7 @@ int cmd_ls_files(int argc, const char **argv, const \n> char *cmd_prefix)\n>  OPT_BIT(0, \"directory\", &dir.flags,\n>  N_(\"show 'other' directories' names only\"),\n>  DIR_SHOW_OTHER_DIRECTORIES),\n> + OPT_BOOL(0, \"eol\", &show_eol, N_(\"show line endings of files\")),\n>  OPT_NEGBIT(0, \"empty-directory\", &dir.flags,\n>  N_(\"don't show empty directories\"),\n>  DIR_HIDE_EMPTY_DIRECTORIES),\n> diff --git a/convert.c b/convert.c\n> index 814e814..61d6757 100644\n> --- a/convert.c\n> +++ b/convert.c\n> @@ -13,6 +13,11 @@\n>  * translation when the \"text\" attribute or \"auto_crlf\" option is set.\n>  */\n>\n> +/* Stat bits: When BIN is set, the txt bits are unset */\n> +#define CONVERT_STAT_BITS_TXT_LF   (1)\n> +#define CONVERT_STAT_BITS_TXT_CRLF (2)\n> +#define CONVERT_STAT_BITS_BIN      (4)\n> +\n> enum crlf_action {\n>  CRLF_GUESS = -1,\n>  CRLF_BINARY = 0,\n> @@ -95,6 +100,62 @@ static int is_binary(unsigned long size, struct \n> text_stat *stats)\n>  return 0;\n> }\n>\n> +static unsigned int gather_convert_stats(const char *data, unsigned long \n> size)\n> +{\n> + struct text_stat stats;\n> + if (!data || !size)\n> + return 0;\n> + gather_stats(data, size, &stats);\n> + if (is_binary(size, &stats) || stats.cr != stats.crlf)\n> + return CONVERT_STAT_BITS_BIN;\n> + else if (stats.crlf && (stats.crlf == stats.lf))\n> + return CONVERT_STAT_BITS_TXT_CRLF;\n> + else if (stats.crlf && stats.lf)\n> + return CONVERT_STAT_BITS_TXT_CRLF | CONVERT_STAT_BITS_TXT_LF;\n> + else if (stats.lf)\n> + return CONVERT_STAT_BITS_TXT_LF;\n> + else\n> + return 0;\n> +}\n> +\n> +static const char *gather_convert_stats_ascii(const char *data, unsigned \n> long size)\n> +{\n> + unsigned int convert_stats = gather_convert_stats(data, size);\n> +\n> + if (convert_stats & CONVERT_STAT_BITS_BIN)\n> + return \"binary\";\n> + switch (convert_stats) {\n> + case CONVERT_STAT_BITS_TXT_LF:\n> + return(\"text-lf\");\n> + case CONVERT_STAT_BITS_TXT_CRLF:\n> + return(\"text-crlf\");\n> + case CONVERT_STAT_BITS_TXT_LF | CONVERT_STAT_BITS_TXT_CRLF:\n> + return(\"text-crlf-lf\");\n> + default:\n> + return (\"text-no-eol\");\n> + }\n> +}\n> +\n> +const char *get_cached_convert_stats_ascii(const char *path)\n> +{\n> + const char *ret;\n> + unsigned long sz;\n> + void *data = read_blob_data_from_cache(path, &sz);\n> + ret = gather_convert_stats_ascii(data, sz);\n> + free(data);\n> + return ret;\n> +}\n> +\n> +const char *get_wt_convert_stats_ascii(const char *path)\n> +{\n> + const char *ret = \"\";\n> + struct strbuf sb = STRBUF_INIT;\n> + if (strbuf_read_file(&sb, path, 0) >= 0)\n> + ret = gather_convert_stats_ascii(sb.buf, sb.len);\n> + strbuf_release(&sb);\n> + return ret;\n> +}\n> +\n> static enum eol output_eol(enum crlf_action crlf_action)\n> {\n>  switch (crlf_action) {\n> @@ -777,6 +838,30 @@ int would_convert_to_git_filter_fd(const char *path)\n>  return apply_filter(path, NULL, 0, -1, NULL, ca.drv->clean);\n> }\n>\n> +const char *get_convert_attr_ascii(const char *path)\n> +{\n> + struct conv_attrs ca;\n> + enum crlf_action crlf_action;\n> +\n> + convert_attrs(&ca, path);\n> + crlf_action = input_crlf_action(ca.crlf_action, ca.eol_attr);\n> + switch (crlf_action) {\n> + case CRLF_GUESS:\n> + return \"\";\n> + case CRLF_BINARY:\n> + return \"-text\";\n> + case CRLF_TEXT:\n> + return \"text\";\n> + case CRLF_INPUT:\n> + return \"eol=lf\";\n> + case CRLF_CRLF:\n> + return \"eol=crlf\";\n> + case CRLF_AUTO:\n> + return \"text=auto\";\n> + }\n> + return \"\";\n> +}\n> +\n> int convert_to_git(const char *path, const char *src, size_t len,\n>                    struct strbuf *dst, enum safe_crlf checksafe)\n> {\n> diff --git a/convert.h b/convert.h\n> index d9d853c..ccf436b 100644\n> --- a/convert.h\n> +++ b/convert.h\n> @@ -32,6 +32,9 @@ enum eol {\n> };\n>\n> extern enum eol core_eol;\n> +extern const char *get_cached_convert_stats_ascii(const char *path);\n> +extern const char *get_wt_convert_stats_ascii(const char *path);\n> +extern const char *get_convert_attr_ascii(const char *path);\n>\n> /* returns 1 if *dst was used */\n> extern int convert_to_git(const char *path, const char *src, size_t len,\n> diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh\n> index b343651..a89f2ba 100755\n> --- a/t/t0027-auto-crlf.sh\n> +++ b/t/t0027-auto-crlf.sh\n> @@ -56,21 +56,16 @@ create_gitattributes () {\n> }\n>\n> create_NNO_files () {\n> - lfname=$1\n> - crlfname=$2\n> - lfmixcrlf=$3\n> - lfmixcr=$4\n> - crlfnul=$5\n>  for crlf in false true input\n>  do\n>  for attr in \"\" auto text -text lf crlf\n>  do\n>  pfx=NNO_${crlf}_attr_${attr} &&\n> - cp $lfname    ${pfx}_LF.txt &&\n> - cp $crlfname  ${pfx}_CRLF.txt &&\n> - cp $lfmixcrlf ${pfx}_CRLF_mix_LF.txt &&\n> - cp $lfmixcr   ${pfx}_LF_mix_CR.txt &&\n> - cp $crlfnul   ${pfx}_CRLF_nul.txt\n> + cp CRLF_mix_LF ${pfx}_LF.txt &&\n> + cp CRLF_mix_LF ${pfx}_CRLF.txt &&\n> + cp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&\n> + cp CRLF_mix_LF ${pfx}_LF_mix_CR.txt &&\n> + cp CRLF_mix_LF ${pfx}_CRLF_nul.txt\n>  done\n>  done\n> }\n> @@ -96,7 +91,7 @@ commit_check_warn () {\n>  crlfnul=$7\n>  pfx=crlf_${crlf}_attr_${attr}\n>  create_gitattributes \"$attr\" &&\n> - for f in LF CRLF repoMIX LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul\n> + for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul CRLF_nul\n>  do\n>  fname=${pfx}_$f.txt &&\n>  cp $f $fname &&\n> @@ -149,6 +144,36 @@ commit_chk_wrnNNO () {\n>  '\n> }\n>\n> +stats_ascii () {\n> + case \"$1\" in\n> + LF)\n> + echo text-lf\n> + ;;\n> + CRLF)\n> + echo text-crlf\n> + ;;\n> + CRLF_mix_LF)\n> + echo text-crlf-lf\n> + ;;\n> + LF_mix_CR)\n> + echo binary\n> + ;;\n> + CRLF_nul)\n> + echo binary\n> + ;;\n> + LF_nul)\n> + echo binary\n> + ;;\n> + CRLF_mix_CR)\n> + echo binary\n> + ;;\n> + *)\n> + echo error_invalid $1\n> + ;;\n> + esac\n> +\n> +}\n> +\n> check_files_in_repo () {\n>  crlf=$1\n>  attr=$2\n> @@ -214,6 +239,20 @@ checkout_files () {\n>  fi\n>  done\n>\n> + test_expect_success \"ls-files --eol $lfname ${pfx}LF.txt\" \"\n> +   test_when_finished 'rm e expect actual' &&\n> + cat >e <<-EOF &&\n> + i/text-crlf w/$(stats_ascii $crlfname) ${src}CRLF.txt\n> + i/text-crlf-lf w/$(stats_ascii $lfmixcrlf) ${src}CRLF_mix_LF.txt\n> + i/text-lf w/$(stats_ascii $lfname) ${src}LF.txt\n> + i/binary w/$(stats_ascii $lfmixcr) ${src}LF_mix_CR.txt\n> + i/binary w/$(stats_ascii $crlfnul) ${src}CRLF_nul.txt\n> + i/binary w/$(stats_ascii $crlfnul) ${src}LF_nul.txt\n> + EOF\n> + sort <e >expect &&\n> + git ls-files --eol $src* | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | \n> sort >actual &&\n> + test_cmp expect actual\n> + \"\n>  test_expect_success \"checkout core.eol=$eol core.autocrlf=$crlf \n> gitattributes=$attr file=LF\" \"\n>  compare_ws_file $pfx $lfname    ${src}LF.txt\n>  \"\n> @@ -231,6 +270,37 @@ checkout_files () {\n>  \"\n> }\n>\n> +# Test control characters\n> +# NUL SOH CR EOF==^Z\n> +test_expect_success 'ls-files --eol -o Text/Binary' '\n> + test_when_finished \"rm e expect actual TeBi_*\" &&\n> + STRT=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA &&\n> + STR=$STRT$STRT$STRT$STRT &&\n> + printf \"${STR}BBB\\001\" >TeBi_127_S &&\n> + printf \"${STR}BBBB\\001\">TeBi_128_S &&\n> + printf \"${STR}BBB\\032\" >TeBi_127_E &&\n> + printf \"\\032${STR}BBB\" >TeBi_E_127 &&\n> + printf \"${STR}BBBB\\000\">TeBi_128_N &&\n> + printf \"${STR}BBB\\012\">TeBi_128_L &&\n> + printf \"${STR}BBB\\015\">TeBi_127_C &&\n> + printf \"${STR}BB\\015\\012\" >TeBi_126_CL &&\n> + printf \"${STR}BB\\015\\012\\015\" >TeBi_126_CLC &&\n> + cat >e <<-\\EOF &&\n> + i/ w/binary TeBi_127_S\n> + i/ w/text-no-eol TeBi_128_S\n> + i/ w/text-no-eol TeBi_127_E\n> + i/ w/binary TeBi_E_127\n> + i/ w/binary TeBi_128_N\n> + i/ w/text-lf TeBi_128_L\n> + i/ w/binary TeBi_127_C\n> + i/ w/text-crlf TeBi_126_CL\n> + i/ w/binary TeBi_126_CLC\n> + EOF\n> + sort <e >expect &&\n> + git ls-files --eol -o | grep TeBi_ | sed -e 's!attr/[=a-z-]*!!g' -e \"s/ \n> */ /g\" | sort >actual &&\n> + test_cmp expect actual\n> +'\n> +\n> #######\n> test_expect_success 'setup master' '\n>  echo >.gitattributes &&\n> @@ -480,4 +550,20 @@ checkout_files    native  true  \"lf\"      LF    CRLF \n> CRLF_mix_LF  LF_mix_CR\n> checkout_files    native  false \"crlf\"    CRLF  CRLF  CRLF \n> CRLF_mix_CR  CRLF_nul\n> checkout_files    native  true  \"crlf\"    CRLF  CRLF  CRLF \n> CRLF_mix_CR  CRLF_nul\n>\n> +\n> +# Should be the last test case: remove some files from the worktree\n> +# run 'git ls-files -d'\n> +test_expect_success 'ls-files --eol -d' \"\n> + rm  crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt \n> crlf_false_attr__LF.txt .gitattributes &&\n> + cat >expect <<-\\EOF &&\n> + i/text-crlf w/ crlf_false_attr__CRLF.txt\n> + i/text-crlf-lf w/ crlf_false_attr__CRLF_mix_LF.txt\n> + i/text-lf w/ .gitattributes\n> + i/text-lf w/ crlf_false_attr__LF.txt\n> + EOF\n> + git ls-files --eol -d | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | \n> sort >actual &&\n> + test_cmp expect actual &&\n> + rm expect actual\n> +\"\n> +\n> test_done\n> -- \n> 2.6.2.403.gd7a84e3\n>\n--\nPhilip \n"},{"id":"274132","messageId":"CAPig+cQayKit8JzYtYJrLE1EFiNAOqpnC+GDm7MpiSO8zHJySw@mail.gmail.com","threadId":"40956","inReplyTo":"5665BD39.1040403@web.de","subject":"Re: [PATCH v7] ls-files: Add eol diagnostics","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-12-07T20:21:20Z","receivedAt":"2015-12-07T20:21:20Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Monday, December 7, 2015, Torsten Bögershausen <tboegi@web.de> wrote:\n> When working in a cross-platform environment, a user wants to\n> check if text files are stored normalized in the repository and if\n> .gitattributes are set appropriately.[...]\n\nA few style comments this time around...\n\n> Helped-By: Eric Sunshine <sunshine@sunshineco.com>\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n> diff --git a/builtin/ls-files.c b/builtin/ls-files.c\n> @@ -47,6 +48,21 @@ static const char *tag_modified = \"\";\n> +static void write_eolinfo(const struct cache_entry *ce, const char *path)\n> +{\n> +       struct stat st;\n> +       const char *i_txt = \"\";\n> +       const char *w_txt = \"\";\n> +       if (!show_eol)\n> +               return;\n> +       if (ce && S_ISREG(ce->ce_mode))\n> +               i_txt = get_cached_convert_stats_ascii(ce->name);\n> +       if (!lstat(path, &st) && (S_ISREG(st.st_mode)))\n\nStyle: unnecessary parentheses around S_ISREG(), which is inconsistent\nwith S_ISREG() two lines above.\n\n> +               w_txt = get_wt_convert_stats_ascii(path);\n> +       printf(\"i/%-13s w/%-13s attr/%-9s \", i_txt, w_txt,\n> +                                get_convert_attr_ascii(path));\n> +}\n> diff --git a/convert.c b/convert.c\n> @@ -95,6 +100,62 @@ static int is_binary(unsigned long size, struct text_stat *stats)\n> +static unsigned int gather_convert_stats(const char *data, unsigned long size)\n> +{\n> +       struct text_stat stats;\n> +       if (!data || !size)\n> +               return 0;\n> +       gather_stats(data, size, &stats);\n> +       if (is_binary(size, &stats) || stats.cr != stats.crlf)\n> +               return CONVERT_STAT_BITS_BIN;\n> +       else if (stats.crlf && (stats.crlf == stats.lf))\n\nStyle: unnecessary parentheses around 'foo == bar'\n\n> +               return CONVERT_STAT_BITS_TXT_CRLF;\n> +       else if (stats.crlf && stats.lf)\n> +               return CONVERT_STAT_BITS_TXT_CRLF | CONVERT_STAT_BITS_TXT_LF;\n> +       else if (stats.lf)\n> +               return CONVERT_STAT_BITS_TXT_LF;\n> +       else\n> +               return 0;\n> +}\n> +\n> +static const char *gather_convert_stats_ascii(const char *data, unsigned long size)\n> +{\n> +       unsigned int convert_stats = gather_convert_stats(data, size);\n> +\n> +       if (convert_stats & CONVERT_STAT_BITS_BIN)\n> +               return \"binary\";\n> +       switch (convert_stats) {\n> +               case CONVERT_STAT_BITS_TXT_LF:\n> +                       return(\"text-lf\");\n\nStyle: space after \"return\".\n\nAlso, can we lose the unnecessary noisy parentheses? (I recall\nmentioning this in my first review.)\n\nSame for \"return\" statements below.\n\n> +               case CONVERT_STAT_BITS_TXT_CRLF:\n> +                       return(\"text-crlf\");\n> +               case CONVERT_STAT_BITS_TXT_LF | CONVERT_STAT_BITS_TXT_CRLF:\n> +                       return(\"text-crlf-lf\");\n> +               default:\n> +                       return (\"text-no-eol\");\n> +       }\n> +}\n> diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh\n> @@ -214,6 +239,20 @@ checkout_files () {\n>                 fi\n>         done\n>\n> +       test_expect_success \"ls-files --eol $lfname ${pfx}LF.txt\" \"\n> +         test_when_finished 'rm e expect actual' &&\n\nStyle: test_when_finished is incorrectly indented with tab+spaces\nrather than only tabs\n\n> +               cat >e <<-EOF &&\n> +               i/text-crlf w/$(stats_ascii $crlfname) ${src}CRLF.txt\n> +               i/text-crlf-lf w/$(stats_ascii $lfmixcrlf) ${src}CRLF_mix_LF.txt\n> +               i/text-lf w/$(stats_ascii $lfname) ${src}LF.txt\n> +               i/binary w/$(stats_ascii $lfmixcr) ${src}LF_mix_CR.txt\n> +               i/binary w/$(stats_ascii $crlfnul) ${src}CRLF_nul.txt\n> +               i/binary w/$(stats_ascii $crlfnul) ${src}LF_nul.txt\n> +               EOF\n> +               sort <e >expect &&\n> +               git ls-files --eol $src* | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&\n> +               test_cmp expect actual\n> +       \"\n> @@ -480,4 +550,20 @@ checkout_files    native  true  \"lf\"      LF    CRLF  CRLF_mix_LF  LF_mix_CR\n>  checkout_files    native  false \"crlf\"    CRLF  CRLF  CRLF         CRLF_mix_CR  CRLF_nul\n>  checkout_files    native  true  \"crlf\"    CRLF  CRLF  CRLF         CRLF_mix_CR  CRLF_nul\n>\n> +\n\nStyle: unnecessary blank line\n\n> +# Should be the last test case: remove some files from the worktree\n> +# run 'git ls-files -d'\n\nThis seems kind of fragile. Might it be possible to either recreate\nthose files when this test finishes or instead provide a function\nwhich creates them on-demand for tests which need them? My concern is\nthat there is a good chance that someone later adding tests will\noverlook this comment, especially since most people just plop new\ntests at the bottom of the file.\n\n> +test_expect_success 'ls-files --eol -d' \"\n> +       rm  crlf_false_attr__CRLF.txt crlf_false_attr__CRLF_mix_LF.txt crlf_false_attr__LF.txt .gitattributes &&\n\nStyle: too many spaces following 'rm'\n\nSame issue raised in my previous review: If one or more of these files\ndid not get created,  for instance, because some earlier test failed,\nthen this 'rm' will fail, thus causing this entire test to fail\nunnecessarily. Therefore, 'rm -f' would make more sense.\n\n> +       cat >expect <<-\\EOF &&\n> +       i/text-crlf w/ crlf_false_attr__CRLF.txt\n> +       i/text-crlf-lf w/ crlf_false_attr__CRLF_mix_LF.txt\n> +       i/text-lf w/ .gitattributes\n> +       i/text-lf w/ crlf_false_attr__LF.txt\n> +       EOF\n> +       git ls-files --eol -d | sed -e 's!attr/[=a-z-]*!!g' -e 's/  */ /g' | sort >actual &&\n> +       test_cmp expect actual &&\n> +       rm expect actual\n\nAlso, from the previous review: test_when_finished() would be a more\nreliable way to clean up these files if they really ought to be\ncleaned up.\n\n> +\"\n> +\n>  test_done\n> --\n> 2.6.2.403.gd7a84e3\n"}]}