Skip to content

mingw: support absolute paths without a drive prefix - #96

Open
dscho wants to merge 2 commits into
gitgitgadget:masterfrom
dscho:drive-prefix
Open

dscho wants to merge 2 commits into
gitgitgadget:masterfrom
dscho:drive-prefix

Conversation

@dscho

@dscho dscho commented Dec 10, 2018 •

Copy link
Copy Markdown
Member

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 dscho mentioned this pull request Dec 10, 2018
35 tasks done
@dscho

dscho commented Dec 10, 2018

Copy link
Copy Markdown
Member Author

/submit

@gitgitgadget

gitgitgadget Bot commented Dec 10, 2018

Copy link
Copy Markdown

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

dscho commented Dec 14, 2018

Copy link
Copy Markdown
Member Author

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

dscho commented Feb 25, 2019

Copy link
Copy Markdown
Member Author

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