4
EOL conversion is provided as a content filter where Bazaar internally
5
stores a canonical format but outputs a convenience format. See
6
``bzr help content-filters`` for general information about using these.
8
Note: Content filtering is only supported in recently added formats,
11
EOL conversion needs to be enabled for selected branches and files using
12
rules. See ``bzr help rules`` for general information on defining rules.
14
To configure which files to filter, set ``eol`` to one of the values below.
15
(If a value is not set, ``exact`` is the default.)
17
============== ============================== ======================
18
Value Checkout end-of-lines as Commit end-of-lines as
19
============== ============================== ======================
20
native crlf on Windows, lf otherwise lf
21
-------------- ------------------------------ ----------------------
23
-------------- ------------------------------ ----------------------
25
-------------- ------------------------------ ----------------------
26
exact No conversion exactly as in file
27
============== ============================== ======================
29
Note: For safety reasons, no conversion is applied to any file where a null
30
byte is detected in the file.
32
For users working on a cross-platform project, here is a suggested rule
33
to use as a starting point::
38
If you have binary files that do not contain a null byte though, be
39
sure to add ``eol = exact`` rules for those as well. You can do this
40
by giving more explicit patterns earlier in the rules file. For example::
48
If your working tree is on a network drive shared by users on different
49
operating systems, you typically want to force certain conventions for
50
certain files. In that way, if a file is created with the wrong line
51
endings or line endings get mixed during editing, it gets committed
52
correctly and gets checked out correctly. For example::
63
If you take the care to create files with their required endings, you can
64
achieve *almost* the same thing by using ``eol = exact``. It is slightly
65
safer to use ``lf`` and ``crlf`` though because edits accidentally
66
introducing mixed line endings will be corrected during commit for files
69
If you have sample test data that deliberately has text files with mixed
70
newline conventions, you can ask for those to be left alone like this::
78
Note that ``exact`` does not imply the file is binary but it does mean
79
that no conversion of end-of-lines will be done. (Bazaar currently relies
80
of content analysis to detect binary files for commands like ``diff``.
81
In the future, a ``binary = true`` rule may be added but it is not
84
If you have an existing repository with text files already stored using
85
Windows newline conventions (crlf), then you may want to keep using that
86
convention in the repository. Forcing certain files to this convention
87
may also help users who do not have rules configured. To do this, set
88
``eol`` to one of the values below.
90
========================= ============================== ======================
91
Value Checkout end-of-lines as Commit end-of-lines as
92
========================= ============================== ======================
93
native-with-crlf-in-repo crlf on Windows, lf otherwise crlf
94
------------------------- ------------------------------ ----------------------
95
lf-with-crlf-in-repo lf crlf
96
------------------------- ------------------------------ ----------------------
97
crlf-with-crlf-in-repo crlf crlf
98
========================= ============================== ======================
100
For users working on an existing project that uses Windows newline
101
conventions in their Bazaar repository, this rule is suggested as a
105
eol = native-with-crlf-in-repo
107
For new projects, it is recommended that end-of-lines be stored as lf
108
and that users stick to the basic settings, i.e. ``native``, ``lf``,
109
``crlf`` and ``exact``.
111
Note: Bazaar's EOL conversion will convert the content of files but
112
never reject files because a given line ending or mixed line endings
113
are found. A precommit hook should be used if you wish to validate
114
(and not just convert) content before committing.