Skip to main content

Module eol

Module eol 

Source
Expand description

Line endings — the part git normally does, which we have to do ourselves.

Git converts on the far side of the filter, so for an encrypted path it would always hit ciphertext rather than content. The conversion therefore moves here, and it moves asymmetrically:

  • clean never reads git’s configuration. The same file has to yield the same plaintext on every machine, or the ciphertext differs and determinism dies.
  • smudge does read it. That is the one moment where machines are allowed to differ, and where they should — but only when the configuration asks. Since 2026-08-11 the case where nothing asks writes the stored bytes back unchanged rather than the platform’s own ending, so two machines differ because someone chose it and not by default; see resolve_output.

Whether a file was normalised at all is recorded in the header’s flag bit, so smudge never has to ask .git-xcrypt — which also removes a real race, since git does not promise to write .git-xcrypt before the files it filters.

Functions§

apply
Applies a resolved line-ending mode to content that was normalised to LF.
git_writes_crlf
Whether git would write CRLF into the working tree for a path it converts itself.
looks_binary
Whether git — and therefore we — would treat this content as binary.
normalisation_is_reversible
Whether the working tree’s own bytes can still be recovered from what clean is about to store.
normalise_to_lf
Replaces every CRLF with LF.
resolve_output
What the working tree should receive, given the declaration and git’s config.
should_normalise
Whether the content should be normalised, given its declared mode.
to_crlf
Rewrites LF as CRLF.