From 599fd1d4ab9232d4944cb617a29446c0b6712690 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 10 Mar 2017 15:53:36 +0100 Subject: [PATCH] fixup! mingw: remove 248-char limit when creating directories Actually, this commit was totally misguided. The path length limit for non-long paths (at least before Windows 10 build 1067 with long paths opted in) *is* 248, and we still want to convert to Root Local Device Path if that limit is reached. I misread the intention of the code when I made that patch to "remove the 248-char limit", thinking that there was a hard limit to 248 characters even in the long path case, which was incorrect. Simply revert that commit and be done. This fixes https://github.com/git-for-windows/git/issues/1084 Signed-off-by: Johannes Schindelin --- compat/mingw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index d51d25fa99e7ab..4713369cd1cc0f 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -496,7 +496,9 @@ int mingw_mkdir(const char *path, int mode) { int ret; wchar_t wpath[MAX_LONG_PATH]; - if (xutftowcs_long_path(wpath, path) < 0) + /* CreateDirectoryW path limit is 248 (MAX_PATH - 8.3 file name) */ + if (xutftowcs_path_ex(wpath, path, MAX_LONG_PATH, -1, 248, + core_long_paths) < 0) return -1; ret = _wmkdir(wpath);