Re: [PATCH/RFC] blame: CRLF in the working tree and LF in the repo
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Apr 28, 2015, 01:17 UTC
- Message-ID
- <20150428011702.GA5015@vauxhall.crustytoothpaste.net>
- In-Reply-To
- <xmqqa8xtxy32.fsf@gitster.dls.corp.google.com>
On Mon, Apr 27, 2015 at 10:47:29AM -0700, Junio C Hamano wrote:
Show 24 quoted lines
> The original says this: > > blame: correctly handle files regardless of autocrlf > > If a file contained CRLF line endings in a repository with > core.autocrlf=input, then blame always marked lines as "Not > Committed Yet", even if they were unmodified. Don't attempt to > convert the line endings when creating the fake commit so that blame > works correctly regardless of the autocrlf setting. > > Reported-by: Ephrim Khong <dr.khong@gmail.com> > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> > Signed-off-by: Junio C Hamano <gitster@pobox.com> > > But if autocrlf=input, then the end-user expectation is to keep the > in-repository data with LF line endings. If your tip-of-the-tree > commit incorrectly has CRLF line endings, and if you were going to > commit what is in the working tree on top, you would be correcting > that mistake by turning the in-repository data into a text file with > LF line endings, so "Not Committed Yet" _is_ the correct behaviour. > > So I think that the reverting that change is the right thing to do. > It really was a change to break the behaviour to match a mistaken > expectation, I would have to say.
I don't have a strong opinion on whether or not this should be reverted, since I don't use Windows and therefore don't use CRLF or the respective options anywhere, nor am I very familiar with how they are supposed to function. Junio has articulated a good rationale for why it's broken, and I'm willing to go along with that.
I will say that perhaps it's worthwhile to write some documentation to explain how the CRLF translation works, as it seems that there's a lot of misunderstanding about it. I am, for the aforementioned reasons, not a good choice to write it.
-- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187