Fixing mixed line endings in multiple branches

Frits Jalvingh jal at
Sun Mar 1 21:17:42 GMT 2009


> Too bad. Unfortunately fixing this will break annotation.
> I know, because we did this at work in 2006, after then in some cases
> it's hard to track down the annotation.
Annotation is not really a problem for me, just a nuisance. But it might
be indicative of other problems to come...

> Once native support for line-endings will land to bzr core, I'd like 
> to find the way to replay history of all my branches and filter out
> wrong line-endings. Unfortunately in your case it's maybe hard.

>> Is there any way that I can tell Bazaar to ignore line endings in 
>> some way?

> The work on this still in progress, but you can use external 
> diff tool (e.g. GNU diff3) in the ignore line-endings mode for merge.
I will try that. Thanks. -- Just did: it helps, thanks!

>> Is there another way to fix the files without having all merges
>> upwards blocked?

> Nope. Only replay the history, but the tool for this is not available 
> yet. FastImport plugin may be can help there, but it lacks this
> feature.

> These two actions should be executed in different order:

> - Now fix prod-1.1 manually like the 1.0 branch.
> - Commit this on the prod-1.1. This only records the merge so it is 
> not retried.
> This way you'll commit the merge of line-endings fix as real 
> line-endings fix. Otherwise you'll have big problems with merge in 
> future.
I don't think it will matter much. I now have done the merge, revert,
fix *and* commit in a single step (i.e. one commit instead of a separate
commit for the merge and another for the fix). But it does not seem to
matter in subsequent merges.

> I think it *could* work, although I don't try it. As I said we
> convert one of our project at work to use LF-only, but we have only 1 
> development branch these days.
> You can experiment with this freely: just branch prod-1.0 & prod-1.1
> on local disk, fix 1.0, merge and fix to 1.1, then make some trivial
> change in 1.0 and try to merge it to 1.1. And you'll see how it'll
> work for you.
I tried that and it works; but I am wondering if complex merges will
work. I tried to find out how bazaar's merge code works but that was a
lot of work. I am wondering if Bazaar ever does three-way merges; if it
does it will see a BASE containing CRLF but THIS and OTHER will have
linefeeds. I wonder (and fear) what it will make of that...

> It will be nice if you post here is this scenario will work for you or
> not.
I just executed all of this on 5 interdependent branches. Merges having
simple changes are done without problems. I have not yet encountered
large problems but will be on the lookout for them the coming week. I'll
let the list know the final verdict ;-)

Thanks for your thoughts on the matter!


More information about the bazaar mailing list