From: Junio C Hamano Date: Mon, 12 Feb 2007 23:02:46 GMT Subject: Re: mingw, windows, crlf/lf, and git Message-ID: <7vk5yn6ktl.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <7vps8f6l81.fsf@assigned-by-dhcp.cox.net> Junio C Hamano writes: > Linus Torvalds writes: > >> Btw, how would I implement this? If I really were energetic enough to >> implement it, I would do: >> ... >> (b) Teach the git-update-index logic about hashing text blobs. > > I agree that we can assume editors can grok files with LF > end-of-line just fine and we would not need to do the reverse > conversion on checkout paths (e.g. "read-tree -u", "checkout-index"). > > Textual diff generation needs to learn the CRLF-to-LF conversion > in diff_populate_filespec(); this needs to be done even when the > caller wants size_only. > > Oops. > > Not so fast. What's your plan for st_size? If I were to do this, I would say the cache should store the size on the filesystem in stat fields. Which means that the object name recorded is text blob _after_ line endings are normalized to LF, and its exploded size does not necessarily match the cached size. So this means that whoever does the diff_populate_filespec() change needs to be careful, but it is not such a big deal.