git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] MSVC: Unbreak real_path for Windows paths

From
Sven Strickroth <email@cs-ware.de>
Date
Apr 8, 2019, 11:26 UTC
Message-ID
<31485f76-13a9-ec3b-16b9-78864490164d@cs-ware.de>
In-Reply-To
<950ee9b8-786f-28cd-3e89-ad174fd857a4@cs-ware.de>

A path such as 'c:/somepath/submodule/../.git/modules/submodule' wasn't resolved correctly any more, because the *nix variant of offset_1st_component is used instead of the Win32 specific version.

Regression was introduced in commit 1cadad6f6 when mingw_offset_1st_component was moved from mingw.c which is included by msvc.c to a separate file. Then, the new file "compat/win32/path-utils.h" was only included for the __CYGWIN__ and __MINGW32__ cases in git-compat-util.h, the case for _MSC_VER was missing.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
 config.mak.uname  | 1 +
 git-compat-util.h | 1 +
 2 files changed, 2 insertions(+)
diff --git a/config.mak.uname b/config.mak.uname
index 32381f5fd1..eb1428858c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -426,6 +426,7 @@ ifeq ($(uname_S),Windows)
 	CFLAGS =
 	BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 	COMPAT_OBJS = compat/msvc.o compat/winansi.o \
+		compat/win32/path-utils.o \
 		compat/win32/pthread.o compat/win32/syslog.o \
 		compat/win32/dirent.o compat/win32/fscache.o
 	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
diff --git a/git-compat-util.h b/git-compat-util.h
index e0275da7e0..9be177e588 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -210,6 +210,7 @@
 #include "compat/mingw.h"
 #include "compat/win32/fscache.h"
 #elif defined(_MSC_VER)
+#include "compat/win32/path-utils.h"
 #include "compat/msvc.h"
 #include "compat/win32/fscache.h"
 #else
-- 
2.21.0.windows.1
Previous: Sven StrickrothNext: Junio C Hamano
Message 5 of 10 in “Unbreak real_path on Windows for already absolute paths (with Visual Studio)”
  1. Unbreak real_path on Windows for already absolute paths (with Visual Studio)Sven Strickroth, Apr 8, 2019
  2. Taylor BlauApr 9, 2019
  3. Torsten BögershausenApr 9, 2019
  4. Sven StrickrothApr 9, 2019
  5. MSVC: Unbreak real_path for Windows pathsSven Strickroth, Apr 8, 2019
  6. Junio C HamanoApr 9, 2019
  7. Torsten BögershausenApr 9, 2019
  8. Junio C HamanoApr 9, 2019
  9. Torsten BögershausenApr 10, 2019
  10. Junio C HamanoApr 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.