Skip to content
  • Torsten Bögershausen's avatar
    ls-files: add eol diagnostics · a7630bd4
    Torsten Bögershausen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarEric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: default avatarTorsten Bögershausen <tboegi@web.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    a7630bd4