|Subject:||Re: [Monotone-devel] Re: line endings with 0.31|
|Date:||Tue, 21 Nov 2006 14:28:31 -0800|
|User-agent:||Thunderbird 18.104.22.168 (Windows/20060719)|
I once accidentally checked in a Photoshop file marked as "ascii" to Perforce. When Perforce saw '\r\n', it replaced it with '\n', but when it saw an '\n' it left it alone. That meant when you saw an '\n' in the post-transformed file, you didn't know if it was originally '\n' or '\r\n'. It was unreadable when it came back out of Perforce, and running DOS2UNIX on it didn't help either.
So, really, the problem is that DOS2UNIX is a many-to-one transformation: "\n" -> "\n", and "\r\n" -> "\n". And many-to-one transformations are irreversible. If it was a strict one-to-one transformation, it would be reversible. And the only way to ensure that is to disallow one of those transformations, namely "\n" -> "\n".
In other words: when a file is marked as "do eol conversion", Monotone should check the file to ensure its EOLs are consistent. If they're not, it should offer to either a) perform an irreversible transformation, thus making it consistent, or b) abort the checkin. monotone would then complain if you checked in a JPEG or a Photoshop file marked "do eol conversion".
I assert that solves Richard Levitte's major objection to storing in '\n'-is-eol canonical form.
|[Prev in Thread]||Current Thread||[Next in Thread]|