rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.83k stars 535 forks source link

newlines #485

Closed sulakm closed 1 year ago

sulakm commented 1 year ago

Please make it preserve cr/lf at least on unaffected files. After running bgf repo cleaner all files where converted from lf to crlf. I wonder why unaffected files were modified. My project is cloned on Windows nut crosstargeted for Linux.

Also bfg did not worked as expected. Command suggested by bfg was rejected by master as well as push. The only options was pull last commit so I was not able to hide my sensitive data at the end.

rtyley commented 1 year ago

Please make it preserve cr/lf at least on unaffected files. After running bgf repo cleaner all files where converted from lf to crlf.

This is definitely not how the BFG is supposed to behave, and I suspect that the BFG wasn't responsible for these changes.

If a file isn't specified for a change, the BFG will leave it exactly how it is, verifiable to the fidelity of a SHA-1 hash. If a file is specified for a change, the BFG will use this specific library for processing the text, which specifically preserves line-breaks:

https://github.com/rtyley/line-break-preserving-line-splitting

It's possible there is a bug somewhere, but it's a bit unlikely. If you could provide a small sample repo containing 'LF' line endings, along with a BFG command that exhibits the behaviour you specify when run against the repo, I can take a further look?

sulakm commented 1 year ago

Sorry, I can't provide a sample. Command was bfg --replace-text passwords.txt .git in the root directory where .git was.

rtyley commented 1 year ago

I've added a couple of specific tests for newline-preservation with #486, but they pass successfully and I haven't been able to reproduce the issue you saw. I think it's quite likely that the newline changes you saw were produced by some other effect than the action of the BFG. If you'd like to produce a small sample repo and a mock passwords.txt that reproduces the issue, I could take another look, but otherwise I'll be closing this issue for now.