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,
9
e.g. 1.14. Be sure that both the repository *and* the branch are
10
in a recent format. (Just setting the format on the repository
11
is not enough.) If content filtering does not appear to be working, use
12
'bzr info -v' to confirm that the branch is using "Working tree format 5"
15
EOL conversion needs to be enabled for selected file patterns using
16
rules. See ``bzr help rules`` for general information on defining rules.
17
Currently, rules are only supported in $BZR_HOME/.bazaar/rules (or
18
%BZR_HOME%/bazaar/2.0/rules on Windows). Branch specific rules will be
19
supported in a future verison of Bazaar.
21
To configure which files to filter, set ``eol`` to one of the values below.
22
(If a value is not set, ``exact`` is the default.)
24
========== ===================================== ======================
25
Value Checkout end-of-lines as Commit end-of-lines as
26
========== ===================================== ======================
27
``native`` ``crlf`` on Windows, ``lf`` otherwise ``lf``
28
---------- ------------------------------------- ----------------------
30
---------- ------------------------------------- ----------------------
31
``crlf`` ``crlf`` ``lf``
32
---------- ------------------------------------- ----------------------
33
``exact`` No conversion Exactly as in file
34
========== ===================================== ======================
36
Note: For safety reasons, no conversion is applied to any file where a null
37
byte is detected in the file.
39
For users working on a cross-platform project, here is a suggested rule
40
to use as a starting point::
45
If you have binary files that do not contain a null byte though, be
46
sure to add ``eol = exact`` rules for those as well. You can do this
47
by giving more explicit patterns earlier in the rules file. For example::
55
If your working tree is on a network drive shared by users on different
56
operating systems, you typically want to force certain conventions for
57
certain files. In that way, if a file is created with the wrong line
58
endings or line endings get mixed during editing, it gets committed
59
correctly and gets checked out correctly. For example::
70
If you take the care to create files with their required endings, you can
71
achieve *almost* the same thing by using ``eol = exact``. It is slightly
72
safer to use ``lf`` and ``crlf`` though because edits accidentally
73
introducing mixed line endings will be corrected during commit for files
76
If you have sample test data that deliberately has text files with mixed
77
newline conventions, you can ask for those to be left alone like this::
85
Note that ``exact`` does not imply the file is binary but it does mean
86
that no conversion of end-of-lines will be done. (Bazaar currently relies
87
of content analysis to detect binary files for commands like ``diff``.
88
In the future, a ``binary = true`` rule may be added but it is not
91
If you have an existing repository with text files already stored using
92
Windows newline conventions (``crlf``), then you may want to keep using that
93
convention in the repository. Forcing certain files to this convention
94
may also help users who do not have rules configured. To do this, set
95
``eol`` to one of the values below.
97
============================ ======================== ======================
98
Value Checkout end-of-lines as Commit end-of-lines as
99
============================ ======================== ======================
100
``native-with-crlf-in-repo`` ``crlf`` on Windows, ``crlf``
102
---------------------------- ------------------------ ----------------------
103
``lf-with-crlf-in-repo`` ``lf`` ``crlf``
104
---------------------------- ------------------------ ----------------------
105
``crlf-with-crlf-in-repo`` ``crlf`` ``crlf``
106
============================ ======================== ======================
108
For users working on an existing project that uses Windows newline
109
conventions in their Bazaar repository, this rule is suggested as a
113
eol = native-with-crlf-in-repo
115
For new projects, it is recommended that end-of-lines be stored as ``lf``
116
and that users stick to the basic settings, i.e. ``native``, ``lf``,
117
``crlf`` and ``exact``.
119
Note: Bazaar's EOL conversion will convert the content of files but
120
never reject files because a given line ending or mixed line endings
121
are found. A precommit hook should be used if you wish to validate
122
(and not just convert) content before committing.