]> git.ipfire.org Git - thirdparty/git.git/commit - convert.c
ls-files: add eol diagnostics
authorTorsten Bögershausen <tboegi@web.de>
Sat, 16 Jan 2016 06:50:02 +0000 (07:50 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Jan 2016 03:48:43 +0000 (19:48 -0800)
commita7630bd4274a0dff7cff8b92de3d3f064e321359
tree6fe17973ac36c4e9295aa64751dbf16eaadb491b
parent0c83680e9c047170614fb08ef222ea4f460e514d
ls-files: add eol diagnostics

When working in a cross-platform environment, a user may want 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:

    "-text"        binary (or with bare CR) file
    "none"         text file without any EOL
    "lf"           text file with LF
    "crlf"         text file with CRLF
    "mixed"        text file with mixed line endings.

The effective text/eol attribute is one of these:

    "", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf"

git ls-files --eol gives an output like this:

    i/none   w/none   attr/text=auto      t/t5100/empty
    i/-text  w/-text  attr/-text          t/test-binary-2.png
    i/lf     w/lf     attr/text eol=lf    t/t5100/rfc2047-info-0007
    i/lf     w/crlf   attr/text eol=crlf  doit.bat
    i/mixed  w/mixed  attr/               locale/XX.po

to show what eol convention is used in the data in the index ('i'),
and in the working tree ('w'), and what attribute is in effect,
for each path that is shown.

Add test cases in t0027.

Helped-By: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-ls-files.txt
builtin/ls-files.c
convert.c
convert.h
t/t0027-auto-crlf.sh