| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Extract code which determines if a path is at a Windows system's root. This incluses drive prefixes (e.g. "C:\") as well as network computer names (e.g. "//computername/").
Getting the dirname of a filesystem root should return the filesystem root itself. E.g. the dirname of "/" is always "/". On Windows, we emulate this behavior and as such, we should return e.g. "C:/" if calling dirname on "C:/". But we currently fail to do so and instead return ".", as we do not check if we actually have a Windows prefix before stripping off the last directory component. Fix this by calling out to `win32_prefix_length` immediately after stripping trailing slashes, returning early if we have a prefix.
When calling `git_path_dirname_r` on a Win32 prefix, e.g. a drive or network share prefix, we always want to return the trailing '/'. This does not work currently when passing in a path like 'C:', where the '/' would not be appended correctly. Fix this by appending a '/' if we try to normalize a Win32 prefix and there is no trailing '/'.
As of recently, we failed to correctly discover repositories at a
Win32 system root. Instead of aborting the upwards-traversal of
the file system, we were looping infinitely when traversal
started at either a Win32 drive prefix ("C:/") or a network path
("//somehost").
The issue has been fixed, so add a test to catch regressions.
|
Okay, wrapped this up now. This fixes #4106 |
Sorry, something went wrong.
|
By the way, I'm open to bikeshedding on the win32_path_prefix interface. I'm not quite keen on its name and behavior, but got no other ideas here. |
Sorry, something went wrong.
|
Thanks for fixing this. 😀 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is part 1/2 of the fix to #4106. I already debugged into the issue and have a fix in mind, but I'm currently stuck at a copy shop and cannot fire up my Windows VM to actually test it. I'll post the second part tomorrow.
The actual problem fixed here is that e.g. git_path_dirname_r("C:/") returns ".", which is simply wrong. It has been fixed to instead return "C:/". The same for network names ("//networkname/").