On Sat, 22 Mar 2008, Linus Torvalds wrote: > > 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)) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html