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

[PATCH 0/7] Final words

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 22, 2008, 18:06 UTC
Message-ID
<alpine.LFD.1.00.0803221049090.3020@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.00.0803221038320.3020@woody.linux-foundation.org>
So the whole patch series looks like this:
	 Makefile            |    1 +
	 builtin-read-tree.c |    2 +-
	 cache.h             |   36 +++++++++-------
	 config.c            |    5 ++
	 dir.c               |    2 +-
	 environment.c       |    1 +
	 name-hash.c         |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++
	 read-cache.c        |   65 +--------------------------
	 unpack-trees.c      |   43 ++++++++++++++++---
	 unpack-trees.h      |   22 +++++-----
	 10 files changed, 199 insertions(+), 97 deletions(-)
	 create mode 100644 name-hash.c

and clearly does add more lines than it deletes, but it all really is pretty simple, and none of this is rocket science or even very intrusive. What took me longest to do was not the actual code itself, but to get _just_ the right approach so that the end result would be as simple and nonintrusive as possible. That core patch 6/7 was redone at least ten times before I was happy with it.

Anyway, perhaps exactly because I tried very hard to make it all make sense, I'm actually very very happy with the patch. I suspect it's too late for v1.5.5 even if I think all the patches are really simple, but I'm hoping it can go into at least "pu" and have people actually *test* it.

Talking about testing, the kind of safety I wanted to get with this patch is perhaps best described by the tests I did not on case-insensitive filesystems, but on regular *good* filesystems together with setting the "core.ignorecase" config variable.

Here's an example of how that patch 6/7 works and tries to be really careful even on a case-sensitive filesystem:

	mkdir test-case
	cd test-case
	git init
	git config core.ignorecase true
	echo "File" > File
	git add File
	git commit -m "Create 'File'"
	git checkout -b other
	git rm File
	echo "file" > file
	git add file
	git commit -m "Create 'file'"
	echo "File" > File
	git checkout master
and now it complains about
	error: Untracked working tree file 'File' would be overwritten by merge.

which is correct, because while it is doing its case-insensitivity checks, it also noticed that "File" did *not* match the stat information for 'file', so it really _is_ an untracked working tree file.

So it's actually trying to be a lot more careful than just saying "ok, we already know about 'File'". See what happens next:

	rm File
	ln file File
	git checkout master

and now it very happily did the switch to master, even though 'File' got overwritten, because now it again found that untracked file 'File', but now it could match it up *exactly* against the case-insensitive file 'file', so git was happy that it wasn't actually throwing away any info, and the fact that it overwrite 'File' was ok, because it considered it the same file as 'file'.

So the whole thing is not only able to handle these name aliases, it actually handles them by checking that it's safe.

Final note: I also did notice that I didn't fix the 'git add" case like I thought I did, it currently only fixes "git status". So I still want to fix "git add" and "git mv" to do the right thing when there are case- insensitive aliases, but that's a separate issue from this particular series..

		Linus
Previous: Linus TorvaldsNext: Linus Torvalds
Message 9 of 29 in “Case-insensitive filesystem support, take 1”
  1. 0/7 Case-insensitive filesystem support, take 1Linus Torvalds, Mar 22, 2008
  2. 1/7 Make unpack_trees_options bit flags actual bitfieldsLinus Torvalds, Mar 22, 2008
  3. 2/7 Move name hashing functions into a file of its ownLinus Torvalds, Mar 22, 2008
  4. 3/7 Make "index_name_exists()" return the cache_entry it foundLinus Torvalds, Mar 22, 2008
  5. 4/7 Make hash_name_lookup able to do case-independent lookupsLinus Torvalds, Mar 22, 2008
  6. 5/7 Add 'core.ignorecase' optionLinus Torvalds, Mar 22, 2008
  7. 6/7 Make branch merging aware of underlying case-insensitive filsystemsLinus Torvalds, Mar 22, 2008
  8. 7/7 Make unpack-tree update removed files before any updated filesLinus Torvalds, Mar 22, 2008
  9. 0/7 Final wordsLinus Torvalds, Mar 22, 2008
  10. Linus TorvaldsMar 22, 2008
  11. 8/7 When adding files to the index, add support for case-independent matchesLinus Torvalds, Mar 22, 2008
  12. 9/7 Make git-add behave more sensibly in a case-insensitive environmentLinus Torvalds, Mar 22, 2008
  13. Junio C HamanoMar 23, 2008
  14. Junio C HamanoMar 23, 2008
  15. Linus TorvaldsMar 23, 2008
  16. Johannes SchindelinMar 22, 2008
  17. Linus TorvaldsMar 22, 2008
  18. Johannes SchindelinMar 22, 2008
  19. t0050: Set core.ignorecase case to activate case insensitivitySteffen Prohaska, Mar 22, 2008
  20. git-init: autodetect core.ignorecaseDmitry Potapov, Mar 25, 2008
  21. Johannes SchindelinMar 25, 2008
  22. git-init: autodetect core.ignorecaseDmitry Potapov, Mar 25, 2008
  23. Dmitry PotapovMar 25, 2008
  24. Dmitry PotapovMar 25, 2008
  25. Linus TorvaldsMar 25, 2008
  26. Dmitry PotapovMar 26, 2008
  27. Linus TorvaldsMar 26, 2008
  28. Derek FawcusMar 25, 2008
  29. Jan HudecMar 25, 2008

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.