diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-03 16:10:34 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-03 16:10:34 -0800 |
commit | 5e738ae820ec53c45895b029baa3a1f63e654b1b (patch) | |
tree | 80624092ee1bf2ae435fc220e6f529f096e2a039 /read-cache.c | |
parent | b281796eeb925f5e91d27cd6c6c579c925577160 (diff) | |
parent | 50906e04e8f48215b0b09841686709b92a2ab2e4 (diff) | |
download | git-5e738ae820ec53c45895b029baa3a1f63e654b1b.tar.gz |
Merge branch 'jj/icase-directory'
* jj/icase-directory:
Support case folding in git fast-import when core.ignorecase=true
Support case folding for git add when core.ignorecase=true
Add case insensitivity support when using git ls-files
Add case insensitivity support for directories when using git status
Case insensitivity support for .gitignore via core.ignorecase
Add string comparison functions that respect the ignore_case variable.
Makefile & configure: add a NO_FNMATCH_CASEFOLD flag
Makefile & configure: add a NO_FNMATCH flag
Conflicts:
Makefile
config.mak.in
configure.ac
fast-import.c
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c index 1f42473e80..4f2e890b01 100644 --- a/read-cache.c +++ b/read-cache.c @@ -608,6 +608,29 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st, ce->ce_mode = ce_mode_from_stat(ent, st_mode); } + /* When core.ignorecase=true, determine if a directory of the same name but differing + * case already exists within the Git repository. If it does, ensure the directory + * case of the file being added to the repository matches (is folded into) the existing + * entry's directory case. + */ + if (ignore_case) { + const char *startPtr = ce->name; + const char *ptr = startPtr; + while (*ptr) { + while (*ptr && *ptr != '/') + ++ptr; + if (*ptr == '/') { + struct cache_entry *foundce; + ++ptr; + foundce = index_name_exists(&the_index, ce->name, ptr - ce->name, ignore_case); + if (foundce) { + memcpy((void *)startPtr, foundce->name + (startPtr - ce->name), ptr - startPtr); + startPtr = ptr; + } + } + } + } + alias = index_name_exists(istate, ce->name, ce_namelen(ce), ignore_case); if (alias && !ce_stage(alias) && !ie_match_stat(istate, alias, st, ce_option)) { /* Nothing changed, really */ |