Skip to content

Commit 813ffc8

Browse files
jeffhostetlerGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge branch 'fix-v4-fsmonitor-long-paths' into try-v4-fsmonitor
2 parents dd521ec + a6f34a8 commit 813ffc8

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

compat/fsmonitor/fsm-health-win32.c

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

5252
struct wt_moved
5353
{
54-
wchar_t wpath[MAX_PATH + 1];
54+
wchar_t wpath[MAX_LONG_PATH + 1];
5555
BY_HANDLE_FILE_INFORMATION bhfi;
5656
} wt_moved;
5757
};
@@ -178,8 +178,8 @@ static int has_worktree_moved(struct fsmonitor_daemon_state *state,
178178
return 0;
179179

180180
case CTX_INIT:
181-
if (xutftowcs_path(data->wt_moved.wpath,
182-
state->path_worktree_watch.buf) < 0) {
181+
if (xutftowcs_long_path(data->wt_moved.wpath,
182+
state->path_worktree_watch.buf) < 0) {
183183
error(_("could not convert to wide characters: '%s'"),
184184
state->path_worktree_watch.buf);
185185
return -1;

compat/fsmonitor/fsm-listen-win32.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct one_watch
2525
DWORD count;
2626

2727
struct strbuf path;
28-
wchar_t wpath_longname[MAX_PATH + 1];
28+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
2929
DWORD wpath_longname_len;
3030

3131
HANDLE hDir;
@@ -128,8 +128,8 @@ static int normalize_path_in_utf8(wchar_t *wpath, DWORD wpath_len,
128128
*/
129129
static void check_for_shortnames(struct one_watch *watch)
130130
{
131-
wchar_t buf_in[MAX_PATH + 1];
132-
wchar_t buf_out[MAX_PATH + 1];
131+
wchar_t buf_in[MAX_LONG_PATH + 1];
132+
wchar_t buf_out[MAX_LONG_PATH + 1];
133133
wchar_t *last_slash = NULL;
134134
wchar_t *last_bslash = NULL;
135135
wchar_t *last;
@@ -138,7 +138,7 @@ static void check_for_shortnames(struct one_watch *watch)
138138
wcscpy(buf_in, watch->wpath_longname);
139139
wcscpy(buf_in + watch->wpath_longname_len, L".git");
140140

141-
if (!GetShortPathNameW(buf_in, buf_out, MAX_PATH))
141+
if (!GetShortPathNameW(buf_in, buf_out, MAX_LONG_PATH))
142142
return;
143143

144144
last_slash = wcsrchr(buf_out, L'/');
@@ -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)
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

203203
/* Build L"<wt-root-path>/<event-rel-path>" */
@@ -211,7 +211,7 @@ static enum get_relative_result get_relative_longname(
211211
* shortname or a longname. This routine allows either to be
212212
* given as input.
213213
*/
214-
if (!GetLongPathNameW(buf_in, buf_out, MAX_PATH)) {
214+
if (!GetLongPathNameW(buf_in, buf_out, MAX_LONG_PATH)) {
215215
/*
216216
* The shortname to longname conversion can fail for
217217
* various reasons, for example if the file has been
@@ -271,10 +271,10 @@ static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
271271
FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
272272
HANDLE hDir;
273273
DWORD len_longname;
274-
wchar_t wpath[MAX_PATH + 1];
275-
wchar_t wpath_longname[MAX_PATH + 1];
274+
wchar_t wpath[MAX_LONG_PATH + 1];
275+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
276276

277-
if (xutftowcs_path(wpath, path) < 0) {
277+
if (xutftowcs_long_path(wpath, path) < 0) {
278278
error(_("could not convert to wide characters: '%s'"), path);
279279
return NULL;
280280
}
@@ -289,7 +289,7 @@ static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
289289
return NULL;
290290
}
291291

292-
if (!GetLongPathNameW(wpath, wpath_longname, MAX_PATH)) {
292+
if (!GetLongPathNameW(wpath, wpath_longname, MAX_LONG_PATH)) {
293293
error(_("[GLE %ld] could not get longname of '%s'"),
294294
GetLastError(), path);
295295
CloseHandle(hDir);
@@ -518,7 +518,7 @@ static int process_worktree_events(struct fsmonitor_daemon_state *state)
518518
struct string_list cookie_list = STRING_LIST_INIT_DUP;
519519
struct fsmonitor_batch *batch = NULL;
520520
const char *p = watch->buffer;
521-
wchar_t wpath_longname[MAX_PATH + 1];
521+
wchar_t wpath_longname[MAX_LONG_PATH + 1];
522522

523523
/*
524524
* If the kernel gets more events than will fit in the kernel

compat/fsmonitor/fsm-settings-win32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ static enum fsmonitor_reason is_virtual(struct repository *r)
7676
*/
7777
static enum fsmonitor_reason is_remote(struct repository *r)
7878
{
79-
wchar_t wpath[MAX_PATH];
80-
wchar_t wfullpath[MAX_PATH];
79+
wchar_t wpath[MAX_LONG_PATH];
80+
wchar_t wfullpath[MAX_LONG_PATH];
8181
size_t wlen;
8282
UINT driveType;
8383

8484
/*
8585
* Do everything in wide chars because the drive letter might be
8686
* a multi-byte sequence. See win32_has_dos_drive_prefix().
8787
*/
88-
if (xutftowcs_path(wpath, r->worktree) < 0)
88+
if (xutftowcs_long_path(wpath, r->worktree) < 0)
8989
return FSMONITOR_REASON_ZERO;
9090

9191
/*
@@ -103,7 +103,7 @@ static enum fsmonitor_reason is_remote(struct repository *r)
103103
* slashes to backslashes. This is essential to get GetDriveTypeW()
104104
* correctly handle some UNC "\\server\share\..." paths.
105105
*/
106-
if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL))
106+
if (!GetFullPathNameW(wpath, MAX_LONG_PATH, wfullpath, NULL))
107107
return FSMONITOR_REASON_ZERO;
108108

109109
driveType = GetDriveTypeW(wfullpath);

0 commit comments

Comments
 (0)