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

Re: [PATCH 0/7] Final words

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 22, 2008, 18:28 UTC
Message-ID
<alpine.LFD.1.00.0803221121520.3020@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.00.0803221049090.3020@woody.linux-foundation.org>
On Sat, 22 Mar 2008, Linus Torvalds wrote:
Show 6 quoted lines
> 
> 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..

git-add will want more than this, but this is an example of what we should do - if 'ignore_case' is set, we probably should disallow adding the same case-insensitive name twice to the index.

This does *not* guarantee that the index never would have aliases when core.ignorecase is set, since the index might have been populated from a tree that was generated on a sane filesystem, and we still allow that, but things like this are probably good things to do for projects that want to work case-insensitively.

So even if you have a case-sensitive filesystem, the goal (I think) should be that you can set core.ignorecase to true, and that should help you work with other people who may be stuck on case-insensitive crud.

Anyway, the reason "git add" didn't actually work with the simple change to dir_add_name() is that "git add" doesn't load the index until *after* it has done the directory traversal (because it actually *wants* to see files that are already in the index).

Something like this at least disallows the dual add if the case has changed.

		Linus
----
 read-cache.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 5dc998d..6aee6e0 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -476,6 +476,13 @@ int add_file_to_index(struct index_state *istate, const char *path, int verbose)
 		return 0;
 	}
 
+	if (ignore_case) {
+		struct cache_entry *alias;
+		alias = index_name_exists(istate, ce->name, ce_namelen(ce), 1);
+		if (alias)
+			die("Will not add file alias '%s' ('%s' already exists in index)", ce->name, alias->name);
+	}
+
 	if (index_path(ce->sha1, path, &st, 1))
 		die("unable to index file %s", path);
 	if (add_index_entry(istate, ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE))
Previous: Linus TorvaldsNext: Linus Torvalds
Message 10 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.