git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Yagnatinsky, Mark" <mark.yagnatinsky@bofa.com>,
	"'git@vger.kernel.org'" <git@vger.kernel.org>
Subject: Re: suggestion for improved docs on autocrlf
Date: Tue, 13 Aug 2019 05:24:52 +0200	[thread overview]
Message-ID: <20190813032452.qg2ufgljm4bjeznr@tb-raspi4> (raw)
In-Reply-To: <xmqqo90u9ric.fsf@gitster-ct.c.googlers.com>

On Mon, Aug 12, 2019 at 11:18:35AM -0700, Junio C Hamano wrote:
> "Yagnatinsky, Mark" <mark.yagnatinsky@bofa.com> writes:
>
> > ...  Assuming the repo has no .gitattributes,
> > is it possible to predict what line endings sample.txt will end up with in my repo?
> > Or does it depend on more information than what I've just written?
>

> Binary packagers can ship custom attributes and config that applies
> globally to the installation, which may affect operations in all of
> your repositories, can't they?

Let me try to split my answer into 3 parts:
- A Git distribution can ship with a global attributes file, but I am not aware of any
  distribution doing this.
  Especially Git for Windpws does not add any (global) .gitattributes file somewhere,
  as far as I know.
- The default value for the global core.autocrlf is typically unset in all
  Unix-like distributions, which does the same as core.autocrlf=false.
- The installer for Git for Windows allows the user to choose what the global
  core.autocrlf should be (false, true, input).
  The help text of the installer mentions what
  e.g. "false" means (line endings "as is"),
  and I don't rember the text for "true" and "input"  out of my head.

Now back to the original question:

Person A  creates a repo with core.autocrlf=false and commite sample.txt with CRLF.
Person B clones that repo with CRLF in the repo. When the worktree is checked out,
sample.txt will have CRLF. Always.

Even if B uses core.autocrlf=input, sample.txt will keep the CRLF when it is commited.
If the line endings need to be changed, there are 2 ways:
Either user B runs dos2unix and commits file with LF.
Or user B runs `git add --renormalize` sample.txt. That needs a
`rm sample.txt && git checkout sample.txt` to update the working tree.

All this is predictable.
A fresh clone does not have any "modified files"; all files with CRLF
stay with CLRF unless they are normalized.

Our documentation mentions
"files that any contributor introduces to the repository"

Is that part understandalble and the distincion between
"existing" and "new" files clear enough ?





  parent reply	other threads:[~2019-08-13  3:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 13:08 suggestion for improved docs on autocrlf Yagnatinsky, Mark
2019-08-08 20:56 ` Torsten Bögershausen
2019-08-08 21:19   ` Yagnatinsky, Mark
2019-08-08 23:08     ` Yagnatinsky, Mark
2019-08-09  3:34       ` Torsten Bögershausen
2019-08-09 15:34         ` Yagnatinsky, Mark
2019-08-11 12:10           ` Torsten Bögershausen
2019-08-12 13:47             ` Yagnatinsky, Mark
2019-08-12 15:46               ` Junio C Hamano
2019-08-12 15:52                 ` Yagnatinsky, Mark
2019-08-12 17:10               ` Torsten Bögershausen
2019-08-12 18:00                 ` Yagnatinsky, Mark
2019-08-12 18:18                   ` Junio C Hamano
2019-08-12 18:30                     ` Yagnatinsky, Mark
2019-08-13  3:24                     ` Torsten Bögershausen [this message]
2019-08-13 15:31                       ` Yagnatinsky, Mark
2019-08-13 15:40                         ` Torsten Bögershausen
2019-08-13 15:44                           ` Yagnatinsky, Mark
2019-08-14 16:28                             ` Yagnatinsky, Mark
2019-08-15  4:56                               ` Yagnatinsky, Mark
2019-08-16  4:20                                 ` Torsten Bögershausen
2019-08-16 19:12                                   ` Yagnatinsky, Mark
2019-08-13 16:40                           ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190813032452.qg2ufgljm4bjeznr@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mark.yagnatinsky@bofa.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).