• Joshua Jensen's avatar
    Add case insensitivity support for directories when using git status · 5102c617
    Joshua Jensen authored
    When using a case preserving but case insensitive file system, directory
    case can differ but still refer to the same physical directory.  git
    status reports the directory with the alternate case as an Untracked
    file.  (That is, when mydir/filea.txt is added to the repository and
    then the directory on disk is renamed from mydir/ to MyDir/, git status
    shows MyDir/ as being untracked.)
    
    Support has been added in name-hash.c for hashing directories with a
    terminating slash into the name hash. When index_name_exists() is called
    with a directory (a name with a terminating slash), the name is not
    found via the normal cache_name_compare() call, but it is found in the
    slow_same_name() function.
    
    Additionally, in dir.c, directory_exists_in_index_icase() allows newly
    added directories deeper in the directory chain to be identified.
    
    Ultimately, it would be better if the file list was read in case
    insensitive alphabetical order from disk, but this change seems to
    suffice for now.
    
    The end result is the directory is looked up in a case insensitive
    manner and does not show in the Untracked files list.
    Signed-off-by: default avatarJoshua Jensen <[email protected]>
    Signed-off-by: default avatarJohannes Sixt <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
    5102c617
name-hash.c 4.63 KB