git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: tboegi@web.de
To: git@vger.kernel.org
Cc: "Torsten Bögershausen" <tboegi@web.de>
Subject: [PATCH v2 2/2] gitattributes: Document the unified "auto" handling
Date: Fri, 26 Aug 2016 22:18:48 +0200	[thread overview]
Message-ID: <20160826201848.28381-1-tboegi@web.de> (raw)
In-Reply-To: <xmqqpoowlgpv.fsf@gitster.mtv.corp.google.com>

From: Torsten Bögershausen <tboegi@web.de>

Update the documentation about text=auto:
text=auto now follows the core.autocrlf handling when files are not
normalized in the repository.

For a cross platform project recommend the usage of attributes for
line-ending conversions.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 Documentation/gitattributes.txt | 58 +++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 34 deletions(-)

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 807577a..7aff940 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -182,23 +182,6 @@ While Git normally leaves file contents alone, it can be configured to
 normalize line endings to LF in the repository and, optionally, to
 convert them to CRLF when files are checked out.
 
-Here is an example that will make Git normalize .txt, .vcproj and .sh
-files, ensure that .vcproj files have CRLF and .sh files have LF in
-the working directory, and prevent .jpg files from being normalized
-regardless of their content.
-
-------------------------
-*               text=auto
-*.txt		text
-*.vcproj	text eol=crlf
-*.sh		text eol=lf
-*.jpg		-text
-------------------------
-
-Other source code management systems normalize all text files in their
-repositories, and there are two ways to enable similar automatic
-normalization in Git.
-
 If you simply want to have CRLF line endings in your working directory
 regardless of the repository you are working with, you can set the
 config variable "core.autocrlf" without using any attributes.
@@ -208,35 +191,42 @@ config variable "core.autocrlf" without using any attributes.
 	autocrlf = true
 ------------------------
 
-This does not force normalization of all text files, but does ensure
+This does not force normalization of text files, but does ensure
 that text files that you introduce to the repository have their line
 endings normalized to LF when they are added, and that files that are
 already normalized in the repository stay normalized.
 
-If you want to interoperate with a source code management system that
-enforces end-of-line normalization, or you simply want all text files
-in your repository to be normalized, you should instead set the `text`
-attribute to "auto" for _all_ files.
+If you want to ensure that text files that any contributor introduces to
+the repository have their line endings normalized, you can set the
+`text` attribute to "auto" for _all_ files.
 
 ------------------------
 *	text=auto
 ------------------------
 
-This ensures that all files that Git considers to be text will have
-normalized (LF) line endings in the repository.  The `core.eol`
-configuration variable controls which line endings Git will use for
-normalized files in your working directory; the default is to use the
-native line ending for your platform, or CRLF if `core.autocrlf` is
-set.
+The attributes allow a fine-grained control, how the line endings
+are converted.
+Here is an example that will make Git normalize .txt, .vcproj and .sh
+files, ensure that .vcproj files have CRLF and .sh files have LF in
+the working directory, and prevent .jpg files from being normalized
+regardless of their content.
+
+------------------------
+*               text=auto
+*.txt		text
+*.vcproj	text eol=crlf
+*.sh		text eol=lf
+*.jpg		-text
+------------------------
+
+NOTE: When `text=auto` conversion is enabled in a cross-platform
+project using push and pull to a central repository the text files
+containing CRLFs should be normalized.
 
-NOTE: When `text=auto` normalization is enabled in an existing
-repository, any text files containing CRLFs should be normalized.  If
-they are not they will be normalized the next time someone tries to
-change them, causing unfortunate misattribution.  From a clean working
-directory:
+From a clean working directory:
 
 -------------------------------------------------
-$ echo "* text=auto" >>.gitattributes
+$ echo "* text=auto" >.gitattributes
 $ rm .git/index     # Remove the index to force Git to
 $ git reset         # re-scan the working directory
 $ git status        # Show files that will be normalized
-- 
2.9.0.243.g5c589a7


  parent reply	other threads:[~2016-08-26 20:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 15:05 t0027 racy? Johannes Schindelin
2016-08-08 15:29 ` Jeff King
2016-08-08 20:32   ` Torsten Bögershausen
2016-08-09  6:51     ` Jeff King
2016-08-09  7:03       ` Jeff King
2016-08-09 11:27         ` Johannes Schindelin
2016-08-09 11:33       ` Torsten Bögershausen
2016-08-09 11:49         ` Jeff King
2016-08-09 12:59           ` Torsten Bögershausen
2016-08-09 13:27             ` Jeff King
2016-08-09 21:28               ` Torsten Bögershausen
2016-08-10 12:28                 ` Johannes Schindelin
2016-08-11 18:58                   ` Torsten Bögershausen
2016-08-11 19:34                     ` Junio C Hamano
2016-08-12  7:24                     ` Jeff King
2016-08-12 16:50           ` [PATCH v1 0/2] Fix conversion warnings tboegi
2016-08-12 16:51           ` [PATCH v1 1/2] t0027: Correct raciness in NNO test tboegi
2016-08-12 17:56             ` Junio C Hamano
2016-08-13 16:50             ` Johannes Sixt
2016-08-13 21:18               ` Torsten Bögershausen
2016-08-14 20:37                 ` Junio C Hamano
2016-08-12 16:51           ` [PATCH v1 2/2] convert: missing `LF will be replaced by CRLF tboegi
2016-08-12 17:52             ` Junio C Hamano
2016-08-13 21:29           ` [PATCH v2 0/1] convert: Correct NNO tests and missing `LF will be replaced by CRLF` tboegi
2016-08-17 12:46             ` Johannes Schindelin
2016-08-13 21:29           ` [PATCH v2 1/1] " tboegi
2016-08-19  9:41           ` [PATCH v1 0/1] Rename NotNormalized (NNO) into CRLF in index tboegi
2016-08-19 16:39             ` Junio C Hamano
2016-08-19  9:41           ` [PATCH v1 1/1] t0027: " tboegi
2016-08-25 15:52           ` [PATCH v1 0/3] Update eol documentation tboegi
2016-08-25 20:31             ` Junio C Hamano
2016-08-26  1:00               ` Jacob Keller
2016-08-26  7:03               ` Torsten Bögershausen
2016-08-25 15:52           ` [PATCH v1 1/2] git ls-files: text=auto eol=lf is supported in Git 2.10 tboegi
2016-08-25 20:38             ` Junio C Hamano
2016-08-25 15:52           ` [PATCH v1 2/2] gitattributes: Document the unified "auto" handling tboegi
2016-08-25 20:46             ` Junio C Hamano
2016-08-26 20:18               ` [PATCH v2 0/2] Adjust the documentation to " tboegi
2016-08-26 20:18               ` [PATCH v2 1/2] git ls-files: text=auto eol=lf is supported in Git 2.10 tboegi
2016-08-26 20:18               ` tboegi [this message]
2016-08-26 20:53                 ` [PATCH v2 2/2] gitattributes: Document the unified "auto" handling Junio C Hamano
2016-08-09 11:33   ` t0027 racy? Johannes Schindelin
2016-08-09 11:38     ` Jeff King
2016-08-08 18:24 ` Torsten Bögershausen
2016-08-09 11:25   ` 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

  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=20160826201848.28381-1-tboegi@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    /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).