]> git.ipfire.org Git - thirdparty/git.git/commit - abspath.c
real_path: canonicalize directory separators in root parts
authorJohannes Sixt <j6t@kdbg.org>
Wed, 21 Dec 2016 21:51:35 +0000 (22:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Dec 2016 18:28:15 +0000 (10:28 -0800)
commite9a379c352b02ca560c58a56aa723994aa42666f
tree03da3113aac766a4bdede4ea66eef4ea1f688aed
parent4ac9006f832d98ca1f25d956e12f3ff79e0d25bc
real_path: canonicalize directory separators in root parts

When an absolute path is resolved, resolution begins at the first path
component after the root part. The root part is just copied verbatim,
because it must not be inspected for symbolic links. For POSIX paths,
this is just the initial slash, but on Windows, the root part has the
forms c:\ or \\server\share. We do want to canonicalize the back-slashes
in the root part because these parts are compared to the result of
getcwd(), which does return a fully canonicalized path.

Factor out a helper that splits off the root part, and have it
canonicalize the copied part.

This change was prompted because t1504-ceiling-dirs.sh caught a breakage
in GIT_CEILING_DIRECTORIES handling on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
abspath.c