summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2022-05-26 21:47:07 +0000
committerJunio C Hamano <gitster@pobox.com>2022-05-26 15:59:26 -0700
commit39664e93093bd9545ad4085523b122196c449508 (patch)
treeabb30251e7a09aaaa74818a0b5980aeb260bbb99 /compat
parent8e8f4b814bab3f1499e50404e344f5b483c91f40 (diff)
downloadgit-39664e93093bd9545ad4085523b122196c449508.tar.gz
fsmonitor--daemon: cd out of worktree root
Teach the fsmonitor--daemon to CD outside of the worktree before starting up. The common Git startup mechanism causes the CWD of the daemon process to be in the root of the worktree. On Windows, this causes the daemon process to hold a locked handle on the CWD and prevents other processes from moving or deleting the worktree while the daemon is running. CD to HOME before entering main event loops. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/fsmonitor/fsm-listen-win32.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/compat/fsmonitor/fsm-listen-win32.c b/compat/fsmonitor/fsm-listen-win32.c
index 4f46bd1d0a..35f2fb9578 100644
--- a/compat/fsmonitor/fsm-listen-win32.c
+++ b/compat/fsmonitor/fsm-listen-win32.c
@@ -424,12 +424,22 @@ static int recv_rdcw_watch(struct one_watch *watch)
}
/*
- * NEEDSWORK: If an external <gitdir> is deleted, the above
- * returns an error. I'm not sure that there's anything that
- * we can do here other than failing -- the <worktree>/.git
- * link file would be broken anyway. We might try to check
- * for that and return a better error message, but I'm not
- * sure it is worth it.
+ * GetOverlappedResult() fails if the watched directory is
+ * deleted while we were waiting for an overlapped IO to
+ * complete. The documentation did not list specific errors,
+ * but I observed ERROR_ACCESS_DENIED (0x05) errors during
+ * testing.
+ *
+ * Note that we only get notificaiton events for events
+ * *within* the directory, not *on* the directory itself.
+ * (These might be properies of the parent directory, for
+ * example).
+ *
+ * NEEDSWORK: We might try to check for the deleted directory
+ * case and return a better error message, but I'm not sure it
+ * is worth it.
+ *
+ * Shutdown if we get any error.
*/
error(_("GetOverlappedResult failed on '%s' [GLE %ld]"),