From b7c13323e702c7aa1d05d952708d1e408c47fae1 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 8 Mar 2020 16:40:05 +0100 Subject: [PATCH] doc: fix texinfo files attributes on Windows While installing git on Windows, the user is prompted by a dialog "Configuring the line ending conversions" to select the value for the git property "core.autocrlf". The default choice proposed by the installer is "Checkout Windows-style, commit Unix-style line endings", that corresponds to "core.autocrlf=true". Even if the dialog provides technical explanation of the different choices, most users will blindly accept the default proposal. With "core.autocrlf=true" git will convert to DOS mode all the text files during "clone" (so can be edited by any crap Windows tool) and convert back to UNIX mode during "push" operation. While this is safe enough for C and TCL files, it breaks the texinfo files. The trailing '@' character used for command continuation in https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Def-Cmd-Continuation-Lines.html does not accept being followed by CR+LF (DOS mode), generating a build error. Same error can be replicated on Linux by passing the file doc/openocd.texi through "unix2dos" command. Tentative to fix this has already been proposed in http://openocd.zylin.com/5294 http://openocd.zylin.com/5413 by breaking the command continuation syntax, which is a no go. The correct fix would require to force/suggest all the Windows users to get rid of the crap DOS mode, but this could have side effects. To workaround the issue, add a .gitattributes file in the doc folder, specifying a local conversion attribute for the files .txt and .texi in the doc folder and overriding the eventual incorrect global value of "core.autocrlf" selected during installation. The local attribute "text eol=lf" is equivalent to the global one "core.autocrlf=input". Change-Id: I468a8f8125b6bc4628fce6c66eb082824ba3413f Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5499 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI Reviewed-by: Tomas Vanek --- doc/.gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/.gitattributes diff --git a/doc/.gitattributes b/doc/.gitattributes new file mode 100644 index 0000000000..dcf6d037ce --- /dev/null +++ b/doc/.gitattributes @@ -0,0 +1,3 @@ +# Avoid DOS conversion of texinfo files during git clone +*.texi text eol=lf +*.txt text eol=lf -- 2.30.2