git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Unresolved issues
Date: Tue, 20 Feb 2007 09:41:44 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0702200934270.20368@woody.linux-foundation.org> (raw)
In-Reply-To: <7virdx1e58.fsf@assigned-by-dhcp.cox.net>



On Mon, 19 Feb 2007, Junio C Hamano wrote:
> 
> * core.autocrlf
> 
>   What's still missing is support for .gitignore like "these files are
>   text" information.

Well, we could actually just do that in stages.

We might start off with just saying "unlike .gitignore", we only support 
one top-level ".gitattributes" file. That makes the problem space much 
simpler, and then we can have code like

	enum file_type {
		FILE_AUTO,
		FILE_BINARY,
		FILE_TEXT
	};

	static enum file_type get_file_type(const char *pathname)
	{
		static int has_initialized = 0;

		if (!has_initialized) {
			has_initialized = 1;
			read_file_attributes_file();
		}
		... check the filename against our attribute rules ..
	}

which would be fairly straightforward, and efficient.

It gets more complicated with per-directory attributes files, because then 
you need to either open those files *all* the time (stupid and expensive 
if you have thousands of files and hundreds of directories), or you need 
to have some way to cache just the ones you need.

(In fact, it might be perfectly fine to have just a *single* cache, which 
is keyed on the dirname of the pathname: if the dirname changes, just 
throw the cache away, and read it in from all the subdirectories leading 
to that directory - you'd still re-read stuff, but all the common cases 
will walk the directory structure in a nice pattern, so you'd have a very 
simple cache that actually gets good cache hit behaviour)

>   One thing that might be tricky is what should be done while making a
>   merge or checking out from a tree.  Ideally, the information should be
>   read from the tree that is being extracted, but that would make the
>   code structure a little bit, eh, "interesting".

No, that would be pretty horrid. So just tell everybody that it's based on 
the working tree. I don't think it's likely to be a problem in practice.

		Linus

  parent reply	other threads:[~2007-02-20 17:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20  7:28 Unresolved issues Junio C Hamano
     [not found] ` <Pine.LNX.4.64.07022009 34270.20368@woody.linux-foundation.org>
2007-02-20  8:57 ` Andy Parkins
2007-02-20 20:10   ` [PATCH] Use git-update-ref to update a ref during commit in git-cvsserver Andy Parkins
2007-02-20 21:57     ` Nicolas Pitre
2007-02-21  5:54     ` Junio C Hamano
2007-02-21  9:08       ` Andy Parkins
2007-02-27 12:48         ` [PATCH 1/2] Make 'cvs ci' lockless in git-cvsserver by using git-update-ref Andy Parkins
2007-02-27 13:55           ` Jakub Narebski
2007-02-27 14:35           ` Nicolas Pitre
2007-02-27 23:44           ` Junio C Hamano
2007-02-28  8:44             ` Andy Parkins
2007-02-28 18:06               ` Junio C Hamano
2007-02-27 12:49         ` [PATCH 2/2] cvsserver: Remove trailing "\n" from commithash in checkin function Andy Parkins
2007-02-27 23:45           ` Junio C Hamano
2007-02-28  8:45             ` Andy Parkins
2007-02-27 23:37       ` [PATCH] Use git-update-ref to update a ref during commit in git-cvsserver Martin Langhoff
2007-02-20 17:41 ` Linus Torvalds [this message]
2007-02-20 21:43   ` Unresolved issues Junio C Hamano
2007-02-21  0:21     ` Linus Torvalds
2007-02-21  0:25       ` Junio C Hamano
2007-02-21  0:39       ` Johannes Schindelin
2007-02-21  0:56         ` Linus Torvalds
2007-02-21  0:51           ` David Lang
2007-02-21  1:12           ` Johannes Schindelin
2007-02-21  1:51           ` Nicolas Pitre
2007-02-21  2:03             ` Linus Torvalds
2007-02-21 16:32           ` Robin Rosenberg
2007-02-21  1:49         ` Theodore Tso
2007-02-21 10:42         ` Martin Waitz
2007-02-21 12:55           ` Johannes Schindelin
2007-02-21 16:57             ` Brian Gernhardt
2007-02-21 17:05               ` Shawn O. Pearce
2007-02-22  8:28 ` [PATCH] git-status: do not be totally useless in a read-only repository Junio C Hamano
2007-02-22  8:30   ` [PATCH] update-index: do not die too early " Junio C Hamano
2007-02-26  1:33 ` Unresolved issues Julian Phillips
2007-02-26  3:39   ` Junio C Hamano
2007-02-26  5:10     ` Julian Phillips
2007-02-26  5:33       ` Junio C Hamano
2007-02-27 20:10   ` Johannes Schindelin
  -- strict thread matches above, loose matches on Subject: below --
2008-03-18  1:12 Junio C Hamano
2008-03-18  1:26 ` Jeff King
2008-03-18  1:56 ` Linus Torvalds
2008-03-19 22:48   ` Sam Vilain
2008-04-19  8:19 Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0702200934270.20368@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).