git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unresolved issues

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 20, 2007, 17:41 UTC
Message-ID
<Pine.LNX.4.64.0702200934270.20368@woody.linux-foundation.org>
In-Reply-To
<7virdx1e58.fsf@assigned-by-dhcp.cox.net>
On Mon, 19 Feb 2007, Junio C Hamano wrote:
Show 5 quoted lines
> 
> * 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
Previous: Martin LanghoffNext: Junio C Hamano
Message 17 of 39 in “Unresolved issues”
  1. Junio C HamanoFeb 20, 2007
  2. Andy ParkinsFeb 20, 2007
  3. Use git-update-ref to update a ref during commit in git-cvsserverAndy Parkins, Feb 20, 2007
  4. Nicolas PitreFeb 20, 2007
  5. Junio C HamanoFeb 21, 2007
  6. Andy ParkinsFeb 21, 2007
  7. 1/2 Make 'cvs ci' lockless in git-cvsserver by using git-update-refAndy Parkins, Feb 27, 2007
  8. Jakub NarebskiFeb 27, 2007
  9. Nicolas PitreFeb 27, 2007
  10. Junio C HamanoFeb 27, 2007
  11. Andy ParkinsFeb 28, 2007
  12. Junio C HamanoFeb 28, 2007
  13. 2/2 cvsserver: Remove trailing "\n" from commithash in checkin functionAndy Parkins, Feb 27, 2007
  14. Junio C HamanoFeb 27, 2007
  15. Andy ParkinsFeb 28, 2007
  16. Martin LanghoffFeb 27, 2007
  17. Linus TorvaldsFeb 20, 2007
  18. Junio C HamanoFeb 20, 2007
  19. Linus TorvaldsFeb 21, 2007
  20. Junio C HamanoFeb 21, 2007
  21. Johannes SchindelinFeb 21, 2007
  22. Linus TorvaldsFeb 21, 2007
  23. David LangFeb 21, 2007
  24. Johannes SchindelinFeb 21, 2007
  25. Nicolas PitreFeb 21, 2007
  26. Linus TorvaldsFeb 21, 2007
  27. Robin RosenbergFeb 21, 2007
  28. Theodore TsoFeb 21, 2007
  29. Martin WaitzFeb 21, 2007
  30. Johannes SchindelinFeb 21, 2007
  31. Brian GernhardtFeb 21, 2007
  32. Shawn O. PearceFeb 21, 2007
  33. git-status: do not be totally useless in a read-only repository.Junio C Hamano, Feb 22, 2007
  34. update-index: do not die too early in a read-only repository.Junio C Hamano, Feb 22, 2007
  35. Julian PhillipsFeb 26, 2007
  36. Junio C HamanoFeb 26, 2007
  37. Julian PhillipsFeb 26, 2007
  38. Junio C HamanoFeb 26, 2007
  39. Johannes SchindelinFeb 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.