Skip to content

Commit 073728e

Browse files
jeffhostetlerdscho
authored andcommitted
Merge branch 'fix-v4-fsmonitor-long-paths' into try-v4-fsmonitor
2 parents 4445300 + bd62d9d commit 073728e

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

compat/fsmonitor/fsm-health-win32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct fsm_health_data
3333

3434
struct wt_moved
3535
{
36-
wchar_t wpath[MAX_PATH + 1];
36+
wchar_t wpath[MAX_LONG_PATH + 1];
3737
BY_HANDLE_FILE_INFORMATION bhfi;
3838
} wt_moved;
3939
};
@@ -142,8 +142,8 @@ static int has_worktree_moved(struct fsmonitor_daemon_state *state,
142142
return 0;
143143

144144
case CTX_INIT:
145-
if (xutftowcs_path(data->wt_moved.wpath,
146-
state->path_worktree_watch.buf) < 0) {
145+
if (xutftowcs_long_path(data->wt_moved.wpath,
146+
state->path_worktree_watch.buf) < 0) {
147147
error(_("could not convert to wide characters: '%s'"),
148148
state->path_worktree_watch.buf);
149149
return -1;

compat/fsmonitor/fsm-listen-win32.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct one_watch
2727
DWORD count;
2828

2929
struct strbuf path;
30-
wchar_t wpath_longname[MAX_PATH + 1];
30+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
3131
DWORD wpath_longname_len;
3232

3333
HANDLE hDir;
@@ -130,8 +130,8 @@ static int normalize_path_in_utf8(wchar_t *wpath, DWORD wpath_len,
130130
*/
131131
static void check_for_shortnames(struct one_watch *watch)
132132
{
133-
wchar_t buf_in[MAX_PATH + 1];
134-
wchar_t buf_out[MAX_PATH + 1];
133+
wchar_t buf_in[MAX_LONG_PATH + 1];
134+
wchar_t buf_out[MAX_LONG_PATH + 1];
135135
wchar_t *last;
136136
wchar_t *p;
137137

@@ -196,8 +196,8 @@ static enum get_relative_result get_relative_longname(
196196
const wchar_t *wpath, DWORD wpath_len,
197197
wchar_t *wpath_longname, size_t bufsize_wpath_longname)
198198
{
199-
wchar_t buf_in[2 * MAX_PATH + 1];
200-
wchar_t buf_out[MAX_PATH + 1];
199+
wchar_t buf_in[2 * MAX_LONG_PATH + 1];
200+
wchar_t buf_out[MAX_LONG_PATH + 1];
201201
DWORD root_len;
202202
DWORD out_len;
203203

@@ -298,10 +298,10 @@ static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
298298
FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
299299
HANDLE hDir;
300300
DWORD len_longname;
301-
wchar_t wpath[MAX_PATH + 1];
302-
wchar_t wpath_longname[MAX_PATH + 1];
301+
wchar_t wpath[MAX_LONG_PATH + 1];
302+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
303303

304-
if (xutftowcs_path(wpath, path) < 0) {
304+
if (xutftowcs_long_path(wpath, path) < 0) {
305305
error(_("could not convert to wide characters: '%s'"), path);
306306
return NULL;
307307
}
@@ -546,7 +546,7 @@ static int process_worktree_events(struct fsmonitor_daemon_state *state)
546546
struct string_list cookie_list = STRING_LIST_INIT_DUP;
547547
struct fsmonitor_batch *batch = NULL;
548548
const char *p = watch->buffer;
549-
wchar_t wpath_longname[MAX_PATH + 1];
549+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
550550

551551
/*
552552
* If the kernel gets more events than will fit in the kernel

compat/fsmonitor/fsm-path-utils-win32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ static int check_remote_protocol(wchar_t *wpath)
6969
*/
7070
int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
7171
{
72-
wchar_t wpath[MAX_PATH];
73-
wchar_t wfullpath[MAX_PATH];
72+
wchar_t wpath[MAX_LONG_PATH];
73+
wchar_t wfullpath[MAX_LONG_PATH];
7474
size_t wlen;
7575
UINT driveType;
7676

7777
/*
7878
* Do everything in wide chars because the drive letter might be
7979
* a multi-byte sequence. See win32_has_dos_drive_prefix().
8080
*/
81-
if (xutftowcs_path(wpath, path) < 0) {
81+
if (xutftowcs_long_path(wpath, path) < 0) {
8282
return -1;
8383
}
8484

@@ -97,7 +97,7 @@ int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
9797
* slashes to backslashes. This is essential to get GetDriveTypeW()
9898
* correctly handle some UNC "\\server\share\..." paths.
9999
*/
100-
if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL)) {
100+
if (!GetFullPathNameW(wpath, MAX_LONG_PATH, wfullpath, NULL)) {
101101
return -1;
102102
}
103103

0 commit comments

Comments
 (0)