jeftadlvw / git-nest

Nest external repositories into your project without git being bothered.
https://github.com/jeftadlvw/git-nest
Apache License 2.0
1 stars 1 forks source link

🐛 incompatibility with case-insensitive filesystems #33

Closed jeftadlvw closed 4 months ago

jeftadlvw commented 4 months ago

See attached image. When cd'ing into a directory so that the working directory is technically the same but the actual path is different, git-nest does some really weird things. It chooses the current working directory as the root (which is technically correct and the same), but chooses the correct path as the repository root and thus says that the current working directory is not a git repository.

Maybe lowecasing paths at comparisons could be enough. I think it's because Windows and MacOS filesystems are case-insensitive by default (which is much preferred, MacOS supports both). Ext-4 on the other hand is case sensitive.

This problem should be taken in consideration when comparing paths. Golang offers a function that checks wether the underlying filesystem is case-sensitive or not: https://pkg.go.dev/github.com/golang/dep/internal/fs#IsCaseSensitiveFilesystem. However, this function performs some system calls, which might lead to performance impacts on larger scale.

I propose a function for comparing paths, which should be the new default way of comparing paths:

func (p Path) Equals(other Path) bool {
   // check for case sensitivity
   // if case insensitive, then lowecase and compare
   // else compare directly
}

screenshot

jeftadlvw commented 4 months ago

This problem should be fixed with 6e46d9c13e3e6950cf057adc1b7c69d61f978223 and 6c184cf19810b3fae73ea7e5a2fb2268d6275618, closing for now.

jeftadlvw commented 4 months ago

This bug report also caused #34 to be opened, an improvement proposal for the path utility model.