Re: mingw, windows, crlf/lf, and git

From: David Lang <david.lang@digitalinsight.com>
Date: 2007-02-13 10:23:00
On Mon, 12 Feb 2007, Linus Torvalds wrote:

> So we'd just need to pass in the information about whether it's binary or
> not, and then do something like
>
> 	@@ -2091,6 +2091,10 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, con
>
> 	 	if (!type)
> 	 		type = blob_type;
> 	+#ifndef __UNIX__
> 	+	if (text && !strcmp(type, blob_type))
> 	+		convert_crlf_to_lf(&buf, &size);
> 	+#endif
> 	 	if (write_object)
> 	 		ret = write_sha1_file(buf, size, type, sha1);
> 	 	else
>
> and that would take care of a lot of things (yeah, I'd not do it that way
> in practice, but really doesn't look that nasty - it's actually much
> nastier to have to look up the text/binary type in the first place).

you could do something like this and it would deal with the srlf/lf problem, but 
if you instead put in the conversion hooks like Ted suggested then you can 
actually gain a LOT more.

his example of openoffice documents that are gziped xml files is a very good 
one. if the 'conversion' is to gunzip on checkin and gzip on checkout then the 
core git logic will work on the nice diffable xml instead of the compressed 
binary blob.

if this is extensable to arbatrary helper functions to do the conversions I'll 
bet that there are many other cases that can use this.

I think the big questions needs to be, is this helper app a filter, or can it be 
passed a filename as the destination (which would let it do things like set 
permissions on the files it creates), or should it be both?

David Lang
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Feb 13 10:47:56 2007

This archive was generated by hypermail 2.1.8 : 2007-02-13 10:58:49 EST