Re: mingw, windows, crlf/lf, and git
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:42:54
On Mon, 12 Feb 2007, Johannes Schindelin wrote:
quoted
(c) Profit!Not so fast.
Aww! And just when I _finally_ had a "step 2".
In order for this to be _useful_, you also have to have a way to _extract_ the text blobs. Not only for read-tree, but _also_ for diff.
Actually, my argument is that we don't need it all that much.
For example, your "read-tree" argument is actually wrong. Anything that is
in a tree is _already_ fixed to be '\n'. So as long as we keep to things
like
git diff version1..version2
we'll actually always get the right version.
Also, the index will make sure that we don't even *try* to diff normal
checked out files.
So the only time you actually really need to test the .gitattributes file
is when you do an "open blob in working tree". And once you do that
function right, and just make sure both git-update-index and yes, the
"diff against working tree" cases use it, you really should be mostly
done.
Both git-update-index and git-diff-files want basically the same
interface:
struct file_buf {
const char *buf;
unsigned long size;
int flags;
}
int read_file(const char *path, struct file_buf *);
close_file(struct file_buf *);
and we should use that instead of the current "open + stat + mmap/read +
close" sequences.
It really shouldn't be too nasty.
Linus