aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorEyvind Bernhardsen <eyvind.bernhardsen@gmail.com>2010-06-04 21:29:08 +0200
committerJunio C Hamano <gitster@pobox.com>2010-06-06 21:20:04 -0700
commit942e7747678ecf5f118ea5b2d0c763166de21f3a (patch)
tree0e5f1e1e72682b183831d0ee76485b6b09e0df41 /Documentation
parent5ec3e67052289217c84e53d2cda90d939ac5725b (diff)
downloadgit-942e7747678ecf5f118ea5b2d0c763166de21f3a.tar.gz
git-942e7747678ecf5f118ea5b2d0c763166de21f3a.tar.xz
Add "core.eol" config variable
Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else. Note that "core.autocrlf" overrides core.eol. This means that [core] autocrlf = true puts CRLFs in the working directory even if core.eol is set to "lf". Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/config.txt35
-rw-r--r--Documentation/gitattributes.txt28
2 files changed, 36 insertions, 27 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 35569a0a7..5cb334c2b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -191,16 +191,13 @@ core.quotepath::
quoted without `-z` regardless of the setting of this
variable.
-core.autocrlf::
- If true, makes git convert `CRLF` at the end of lines in text files to
- `LF` when reading from the filesystem, and convert in reverse when
- writing to the filesystem. The variable can be set to
- 'input', in which case the conversion happens only while
- reading from the filesystem but files are written out with
- `LF` at the end of lines. A file is considered
- "text" (i.e. be subjected to the autocrlf mechanism) based on
- the file's `text` attribute, or if `text` is unspecified,
- based on the file's contents. See linkgit:gitattributes[5].
+core.eol::
+ Sets the line ending type to use in the working directory for
+ files that have the `text` property set. Alternatives are
+ 'lf', 'crlf' and 'native', which uses the platform's native
+ line ending. The default value is `native`. See
+ linkgit:gitattributes[5] for more information on end-of-line
+ conversion.
core.safecrlf::
If true, makes git check if converting `CRLF` is reversible when
@@ -214,7 +211,7 @@ core.safecrlf::
irreversible conversion but continue the operation.
+
CRLF conversion bears a slight chance of corrupting data.
-autocrlf=true will convert CRLF to LF during commit and LF to
+When it is enabled, git will convert CRLF to LF during commit and LF to
CRLF during checkout. A file that contains a mixture of LF and
CRLF before the commit cannot be recreated by git. For text
files this is the right thing to do: it corrects line endings
@@ -238,15 +235,25 @@ converting CRLFs corrupts data.
+
Note, this safety check does not mean that a checkout will generate a
file identical to the original file for a different setting of
-`core.autocrlf`, but only for the current one. For example, a text
-file with `LF` would be accepted with `core.autocrlf=input` and could
-later be checked out with `core.autocrlf=true`, in which case the
+`core.eol` and `core.autocrlf`, but only for the current one. For
+example, a text file with `LF` would be accepted with `core.eol=lf`
+and could later be checked out with `core.eol=crlf`, in which case the
resulting file would contain `CRLF`, although the original file
contained `LF`. However, in both work trees the line endings would be
consistent, that is either all `LF` or all `CRLF`, but never mixed. A
file with mixed line endings would be reported by the `core.safecrlf`
mechanism.
+core.autocrlf::
+ Setting this variable to "true" is almost the same as setting
+ the `text` attribute to "auto" on all files except that text
+ files are not guaranteed to be normalized: files that contain
+ `CRLF` in the repository will not be touched. Use this
+ setting if you want to have `CRLF` line endings in your
+ working directory even though the repository does not have
+ normalized line endings. This variable can be set to 'input',
+ in which case no output conversion is performed.
+
core.symlinks::
If false, symbolic links are checked out as small plain files that
contain the link text. linkgit:git-update-index[1] and
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 1120b90a5..c2efe4c07 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -99,7 +99,7 @@ This attribute enables and controls end-of-line normalization. When a
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.autocrlf` configuration variable for all text files.
+`core.eol` configuration variable for all text files.
Set::
@@ -120,9 +120,9 @@ Set to string value "auto"::
Unspecified::
- If the `text` attribute is unspecified, git uses the `eol`
- attribute and the `core.autocrlf` configuration variable to
- determine if the file should be converted.
+ If the `text` attribute is unspecified, git uses the
+ `core.autocrlf` configuration variable to determine if the
+ file should be converted.
Any other value causes git to act as if `text` has been left
unspecified.
@@ -132,19 +132,19 @@ unspecified.
This attribute sets a specific line-ending style to be used in the
working directory. It enables end-of-line normalization without any
-content checks, similar to setting the `text` attribute.
+content checks, effectively setting the `text` attribute.
Set to string value "crlf"::
- This setting forces git to normalize line endings on checkin
- and convert them to CRLF when the file is checked out,
- regardless of `text` and `core.autocrlf`.
+ This setting forces git to normalize line endings for this
+ file on checkin and convert them to CRLF when the file is
+ checked out.
Set to string value "lf"::
This setting forces git to normalize line endings to LF on
checkin and prevents conversion to CRLF when the file is
- checked out, regardless of `text` and `core.autocrlf`.
+ checked out.
Backwards compatibility with `crlf` attribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -193,9 +193,7 @@ config variable "core.autocrlf" without changing any attributes.
This does not force normalization of all 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. You can also
-set `autocrlf` to "input" to have automatic normalization of new text
-files without conversion to CRLF in the working directory.
+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
@@ -207,7 +205,11 @@ attribute to "auto" for _all_ files.
------------------------
This ensures that all files that git considers to be text will have
-normalized (LF) line endings in the repository.
+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.
NOTE: When `text=auto` normalization is enabled in an existing
repository, any text files containing CRLFs should be normalized. If