Skip to content

Commit

Permalink
Merge pull request #3309 from dscho/fsmonitor-and-unicode-paths
Browse files Browse the repository at this point in the history
fsmonitor: handle non-ASCII characters in the git_dir/worktree paths
  • Loading branch information
dscho committed Jul 6, 2021
2 parents ef510a3 + ae49c84 commit 3d45ac8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compat/fsmonitor/fsmonitor-fs-listen-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
DWORD share_mode =
FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
HANDLE hDir;
wchar_t wpath[MAX_LONG_PATH];

hDir = CreateFileA(path,
if (xutftowcs_long_path(wpath, path) < 0) {
error(_("could not convert to wide characters: '%s'"), path);
return NULL;
}

hDir = CreateFileW(wpath,
desired_access, share_mode, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
NULL);
Expand Down

0 comments on commit 3d45ac8

Please sign in to comment.