Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1045 - Correctly resolve mapped drive on Windows #1334

Merged
merged 1 commit into from Jan 19, 2021

Conversation

egfx-notifications
Copy link
Contributor

Description

fs.realpath.native in NodeJS uses the Win32 API function GetFinalPathNameByHandle() on Windows hosts,
therefore a given path must follow the guidelines for Win32 API file functions.
Drive letters on Windows need to end on a backslash according to the Win32 File Naming Conventions (https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file)
Omitting the backslash results in Windows treating the remaining path components as a relative path starting from the current directory on the specified disk (https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths)

I tested this implementation for several repositories on Windows 10 using:

  • Repositories on UNC path
  • Repositories on mapped drive
  • Repositories on local drive

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

fs.realpath.native in NodeJS uses the Win32 API function GetFinalPathNameByHandle() on Windows hosts,
therefore a given path must follow the guidelines for Win32 API file functions.
Drive letters on Windows need to end on a backslash according to the Win32 File Naming Conventions (https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file)
Omitting the backslash results in Windows treating the remaining path components as a relative path starting from the current directory on the specified disk
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths
@eamodio eamodio added this to the Soon™ milestone Jan 19, 2021
@eamodio eamodio merged commit 992e810 into gitkraken:main Jan 19, 2021
@eamodio eamodio added the verified ✔ Verified label Jan 19, 2021
@eamodio eamodio self-assigned this Jan 19, 2021
@eamodio
Copy link
Member

eamodio commented Jan 19, 2021

Incredible investigation! Thank you so much for getting to the bottom of this!

Thank you!

@egfx-notifications
Copy link
Contributor Author

You're welcome 😄

@egfx-notifications egfx-notifications deleted the fix/mapped-drive-windows branch January 20, 2021 08:54
@eamodio eamodio modified the milestones: Soon™, Shipped Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants