From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/5] Abide by our own rules regarding line endings
Date: Tue, 2 May 2017 14:29:44 +0200 (CEST) [thread overview]
Message-ID: <cover.1493728172.git.johannes.schindelin@gmx.de> (raw)
Over the past decade, there have been a couple of attempts to remedy the
situation regarding line endings (Windows/DOS line endings are
traditionally CR/LF even if many current applications can handle LF,
too, Linux/MacOSX/*BSD/Unix uses LF-only line handlings, and old MacOS
software used to use CR-only line endings).
The current idea seems to be that the default line endings differ
depending on the platform, and for files that should be exempt from that
default, we strongly recommend using .gitattributes to define what the
source code requires.
It is time to heed our own recommendation and mark the files that
require LF-only line endings in our very own .gitattributes.
For starters, those files include shell scripts: the most prevalent
shell interpreter in use (and certainly used in Git for Windows) is
Bash, and Bash does not handle CR/LF line endings gracefully.
There are even two shell scripts that are used in the test suite even if
they are not technically supposed to be part of core Git, as indicated
by their habitat inside contrib/: git-new-workdir and
git-completion.bash.
Related to shell scripts: when generating common-cmds.h, we use tools
that generally operate on the assumption that input and output
deliminate their lines using LF-only line endings. Consequently, they
would happily copy the CR byte verbatim into the strings in
common-cmds.h, which in turn makes the C preprocessor barf (that
interprets them as MacOS-style line endings).
Further, the most obvious required fixes concern tests' support files
committed verbatim, to be compared to Git's output, which is always
LF-only.
There are a few SVN dump files, too, supporting the Subversion-related
tests, requiring LF-only line endings.
Finally, the test suite makes use of text files that are not obviously
supporting tests, such as t/README, comparing them to LF-only versions
(and consequently failing if the files have been checked out with CR/LF
line endings). Therefore we need to mark those as LF-only in the
.gitattributes, too.
Without these fixes, Git will fail to build and pass the test suite, as
can be verified even on Linux using this cadence:
git config core.autocrlf true
rm .git/index && git stash
make DEVELOPER=1 -j15 test
Note: I separated out the change marking t/t4051/* as LF-only into an
individual commit for one reason: it would appear that the test passes
if checked out using core.autocrlf=true on Linux, but on Windows the
test fails. In that respect, this test is special, as the other changes
can be easily validated even without using Windows.
Johannes Schindelin (5):
Fix build with core.autocrlf=true
git-new-workdir: mark script as LF-only
completion: mark bash script as LF-only
Fix the remaining tests that failed with core.autocrlf=true
t4051: mark supporting files as requiring LF-only line endings
.gitattributes | 8 +++++++-
contrib/completion/.gitattributes | 1 +
contrib/workdir/.gitattributes | 1 +
git-gui/.gitattributes | 1 +
t/.gitattributes | 29 ++++++++++++++++++++++++++++-
5 files changed, 38 insertions(+), 2 deletions(-)
create mode 100644 contrib/completion/.gitattributes
create mode 100644 contrib/workdir/.gitattributes
base-commit: d2bbb7c2bcf6e77ebfcabf4e12110fe6d5c91de6
Published-As: https://github.com/dscho/git/releases/tag/lf-attrs-v1
Fetch-It-Via: git fetch https://github.com/dscho/git lf-attrs-v1
--
2.12.2.windows.2.800.gede8f145e06
next reply other threads:[~2017-05-02 12:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 12:29 Johannes Schindelin [this message]
2017-05-02 12:30 ` [PATCH 1/5] Fix build with core.autocrlf=true Johannes Schindelin
2017-05-02 12:30 ` [PATCH 2/5] git-new-workdir: mark script as LF-only Johannes Schindelin
2017-05-02 12:30 ` [PATCH 3/5] completion: mark bash " Johannes Schindelin
2017-05-02 12:30 ` [PATCH 4/5] Fix the remaining tests that failed with core.autocrlf=true Johannes Schindelin
2017-05-02 12:30 ` [PATCH 5/5] t4051: mark supporting files as requiring LF-only line endings Johannes Schindelin
2017-05-02 21:56 ` [PATCH 0/5] Abide by our own rules regarding " Jonathan Nieder
2017-05-03 14:23 ` Johannes Schindelin
2017-05-04 5:19 ` Junio C Hamano
2017-05-04 9:47 ` Johannes Schindelin
2017-05-04 15:04 ` Junio C Hamano
2017-05-04 18:48 ` Johannes Schindelin
2017-05-07 5:29 ` Junio C Hamano
2017-05-08 10:49 ` Johannes Schindelin
2017-05-04 9:49 ` [PATCH v2 0/7] " Johannes Schindelin
2017-05-04 9:49 ` [PATCH v2 1/7] Fix build with core.autocrlf=true Johannes Schindelin
2017-05-08 5:08 ` Junio C Hamano
2017-05-04 9:49 ` [PATCH v2 2/7] git-new-workdir: mark script as LF-only Johannes Schindelin
2017-05-08 5:11 ` Junio C Hamano
2017-05-04 9:49 ` [PATCH v2 3/7] completion: mark bash " Johannes Schindelin
2017-05-04 9:49 ` [PATCH v2 4/7] t3901: move supporting files into t/t3901/ Johannes Schindelin
2017-05-08 5:12 ` Junio C Hamano
2017-05-04 9:50 ` [PATCH v2 5/7] t4003, t4005, t4007 & t4008: handle CR/LF in t/README & t/diff-lib/README Johannes Schindelin
2017-05-08 5:14 ` Junio C Hamano
2017-05-04 9:50 ` [PATCH v2 6/7] Fix the remaining tests that failed with core.autocrlf=true Johannes Schindelin
2017-05-08 5:22 ` Junio C Hamano
2017-05-04 9:50 ` [PATCH v2 7/7] t4051: mark supporting files as requiring LF-only line endings Johannes Schindelin
2017-05-08 5:29 ` Junio C Hamano
2017-05-09 11:20 ` Johannes Schindelin
2017-05-09 12:53 ` [PATCH v3 0/6] Abide by our own rules regarding " Johannes Schindelin
2017-05-09 12:53 ` [PATCH v3 1/6] Fix build with core.autocrlf=true Johannes Schindelin
2017-05-22 17:57 ` Jonathan Nieder
2017-05-23 3:35 ` Junio C Hamano
2017-05-23 9:01 ` Johannes Schindelin
2017-05-09 12:53 ` [PATCH v3 2/6] git-new-workdir: mark script as LF-only Johannes Schindelin
2017-05-09 12:54 ` [PATCH v3 3/6] completion: mark bash " Johannes Schindelin
2017-05-09 12:54 ` [PATCH v3 4/6] t3901: move supporting files into t/t3901/ Johannes Schindelin
2017-05-09 12:54 ` [PATCH v3 5/6] Fix the remaining tests that failed with core.autocrlf=true Johannes Schindelin
2017-05-09 12:54 ` [PATCH v3 6/6] t4051: mark supporting files as requiring LF-only line endings Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1493728172.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).