Skip to content

Commit 3d45ac8

Browse files
authored
Merge pull request #3309 from dscho/fsmonitor-and-unicode-paths
fsmonitor: handle non-ASCII characters in the git_dir/worktree paths
2 parents ef510a3 + ae49c84 commit 3d45ac8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compat/fsmonitor/fsmonitor-fs-listen-win32.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,14 @@ static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
111111
DWORD share_mode =
112112
FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
113113
HANDLE hDir;
114+
wchar_t wpath[MAX_LONG_PATH];
114115

115-
hDir = CreateFileA(path,
116+
if (xutftowcs_long_path(wpath, path) < 0) {
117+
error(_("could not convert to wide characters: '%s'"), path);
118+
return NULL;
119+
}
120+
121+
hDir = CreateFileW(wpath,
116122
desired_access, share_mode, NULL, OPEN_EXISTING,
117123
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
118124
NULL);

0 commit comments

Comments
 (0)