On Thu, May 23, 2024 at 5:50 AM Peter Damianov <peter0...@disroot.org> wrote: > > By default, git has the "autocrlf" """feature""" enabled. This causes the > files > to have CRLF line endings when checked out on windows, which in the case of > configure, causes confusing errors like: > > ./gcc/configure: line 14: $'\r': command not found > ./gcc/configure: line 29: syntax error near unexpected token `newline' > '/gcc/configure: line 29: ` ;; > > when it is invoked. > > Any files damaged in this way can be fixed with: > $ git config core.autocrlf false > $ git reset > $ git checkout . > > But, it's better to simply avoid this problem in the first place. > This behavior is never helpful or desired for gcc.
For files added/edited on Windows does this then also strip the \r (upon which action?)? Otherwise I think this looks good but I'm not a git expert. Richard. > Signed-off-by: Peter Damianov <peter0...@disroot.org> > --- > .gitattributes | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/.gitattributes b/.gitattributes > index e75bfc595bf..1e116987c98 100644 > --- a/.gitattributes > +++ b/.gitattributes > @@ -8,3 +8,6 @@ ChangeLog > whitespace=indent-with-non-tab,space-before-tab,trailing-space > # Use together with git config diff.md.xfuncname '^\(define.*$' > # which is run by contrib/gcc-git-customization.sh too. > *.md diff=md > + > +# Disable lf -> crlf translation on windows. > +* -crlf > -- > 2.39.2 >