From: Jeff King <peff@peff.net>
To: Sergey Lukashev <lukashev.s@ya.ru>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: unclear docs
Date: Mon, 28 Jan 2019 11:06:20 -0500 [thread overview]
Message-ID: <20190128160620.GA23588@sigill.intra.peff.net> (raw)
In-Reply-To: <57362151548583138@iva8-37fc2ad204cd.qloud-c.yandex.net>
On Sun, Jan 27, 2019 at 12:58:58PM +0300, Sergey Lukashev wrote:
> Could somebody please explain what 'core.autocrlf overrides core.eol'
> means given that we have the following statement in core.eol docs:
> "Sets the line ending type to use in the working directory for files
> that have the text property set when core.autocrlf is false".
>
> I would like to know which line endings I'm supposed to get in the
> working tree if I have core.autocrlf=false and '* text=auto' in
> .gitattributes on windows. I get CRLFs which is consistent with the
> last quote but I don't understand what 'core.autocrlf overrides
> core.eol' means in this case.
I think it means:
- if core.autocrlf is false (the default), then the text attribute and
core.eol are used
- if core.autocrlf is true, then that overrides the whole
attribute/eol system
This unfortunate complexity is due to historical reasons (the
much-simpler autocrlf came first, and we had to maintain compatibility
with it). I agree the wording in the documentation is pretty vague.
Perhaps the patch below makes it more clear (I similarly looked at the
definitions of core.autocrlf and core.eol, but they make the distinction
that autocrlf only matters when "true").
-- >8 --
Subject: [PATCH] doc/gitattributes: clarify "autocrlf overrides eol"
We only override core.eol with core.autocrlf when the latter is set to
"true" (otherwise, core.eol would never do anything!). Let's make this
more clear, and point the reader to the git-config definitions, which
discuss this in more detail.
Noticed-by: Sergey Lukashev <lukashev.s@ya.ru>
Signed-off-by: Jeff King <peff@peff.net>
---
Documentation/gitattributes.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index b8392fc330..0ce8740e44 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -124,7 +124,8 @@ text file is normalized, its line endings are converted to LF in the
repository. To control what line ending style is used in the working
directory, use the `eol` attribute for a single file and the
`core.eol` configuration variable for all text files.
-Note that `core.autocrlf` overrides `core.eol`
+Note that setting `core.autocrlf` to `true` overrides `core.eol` (see
+the definitions of those options in linkgit:git-config[1]).
Set::
--
2.20.1.845.g57b86ca485
next prev parent reply other threads:[~2019-01-28 17:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-27 9:58 unclear docs Sergey Lukashev
2019-01-27 11:55 ` Sergey Lukashev
2019-01-28 16:09 ` Jeff King
2019-01-28 18:12 ` Sergey Lukashev
2019-01-28 18:31 ` Jeff King
2019-01-29 7:38 ` Torsten Bögershausen
2019-01-29 10:28 ` Sergey Lukashev
2019-01-29 12:40 ` [PATCH v2 0/2] eol/autocrlf doc clarifications Jeff King
2019-01-29 12:41 ` [PATCH v2 1/2] doc/gitattributes: clarify "autocrlf overrides eol" Jeff King
2019-01-29 12:41 ` [PATCH v2 2/2] docs/config: clarify "text property" in core.eol Jeff King
2019-01-28 17:31 ` unclear docs Torsten Bögershausen
2019-01-28 16:06 ` Jeff King [this message]
2019-01-28 18:30 ` Junio C Hamano
2019-01-28 18:32 ` Jeff King
2019-01-28 20:16 ` Sergey Lukashev
2019-01-28 20:46 ` Jeff King
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=20190128160620.GA23588@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=lukashev.s@ya.ru \
/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).