Content filter sample: eol plugin

Talden talden at gmail.com
Mon May 19 04:48:21 BST 2008


>>>  ====== ======================= ========================================
>>>  Value  Commit newlines as      On checkout, convert newlines to
>>>  ====== ======================= ========================================
>>>  exact  exactly as in file      No conversion
>>>  ------ ----------------------- ----------------------------------------
>>>  native lf                      crlf on Windows, otherwise lf
>>>  ------ ----------------------- ----------------------------------------
>>>  dos    crlf                    crlf on Windows, otherwise lf
>>>  ====== ======================= ========================================
>>
>> So how do I force *.sh to LF when checked out on a Windows machine (IE
>> to include those files in an multi-platform installation image).
>> Similarly, how do I force *.bat to CRLF when checked out on a linux
>> box (for the same reason as for .sh).
>
> [*.sh]
> eol = exact
>
> [*.bat]
> eol = exact
>
> Ian C.

Ahh, it seems that this plugin solves a different problem to that hit
by my developers.  All of the tools know how to _render_ EOLs of both
kinds fine but some of the tools do not respect the EOLs currently in
the file when adding new EOLs - they might add CRLF lines to a .sh.
In this circumstance this plugin can't help since we don't want exact,
we want EOLs normalised to a target form for certain file-types.

Perhaps these are two combination types that are desirable.

[*.sh]
eol = nix

[*.bat]
eol = dos

meaning commits will be in the target form and no conversion.

====== ======================= ========================================
Value  Commit newlines as      On checkout, convert newlines to
====== ======================= ========================================
exact  exactly as in file      No conversion
------ ----------------------- ----------------------------------------
dos    crlf                    No conversion
------ ----------------------- ----------------------------------------
nix    lf                      No conversion
------ ----------------------- ----------------------------------------
native lf                      crlf on Windows, otherwise lf
====== ======================= ========================================

Failing that we're back to using scripted conversion of files at build
time to enforce the rules and just have to live with noisy commits.

--
Talden



More information about the bazaar mailing list