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

mingw: support absolute paths without a drive prefix #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dscho
Copy link
Member

@dscho dscho commented Dec 10, 2018

On Windows, when using a path like \hello\world, it is silently understood to be absolute, but relative to the current directory's drive.

Let's support that, too.

Changes since v1:

  • Replaced the incorrect iswalpha() call: DOS drive letters need to be ASCII, not arbitrary letters (pointed out by Hannes Sixt).

On Windows, there are several categories of absolute paths. One such
category starts with a backslash and is implicitly relative to the
drive associated with the current working directory. Example:

	c:
	git clone https://github.com/git-for-windows/git \G4W

should clone into C:\G4W.

There is currently a problem with that, in that mingw_mktemp() does not
expect the _wmktemp() function to prefix the absolute path with the
drive prefix, and as a consequence, the resulting path does not fit into
the originally-passed string buffer. The symptom is a "Result too large"
error.

Reported by Juan Carlos Arevalo Baeza.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member Author

dscho commented Dec 10, 2018

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 10, 2018

Submitted as pull.96.git.gitgitgadget@gmail.com

When specifying an absolute path without a drive prefix, we convert that
path internally. Let's make sure that we handle that case properly, too
;-)

This fixes the command

	git clone https://github.com/git-for-windows/git \G4W

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho added ready to submit Has commits that have not been submitted yet and removed ready to submit Has commits that have not been submitted yet labels Dec 11, 2018
@dscho
Copy link
Member Author

dscho commented Dec 14, 2018

Looks like this fixes a regression that was not even present in upstream Git yet...

@dscho dscho added the needs-work These patches have pending issues that need to be resolved before submitting label Dec 14, 2018
@dscho
Copy link
Member Author

dscho commented Feb 25, 2019

Looks like this fixes a regression that was not even present in upstream Git yet...

Indeed. It was introduced by the use of GetFullPathNameW() of the patch introducing support for long paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work These patches have pending issues that need to be resolved before submitting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant