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>
This commit is contained in:
Jeff Hostetler
2022-05-26 21:47:07 +00:00
committed by Junio C Hamano
parent 8e8f4b814b
commit 39664e9309
3 changed files with 47 additions and 8 deletions

View File

@@ -54,6 +54,7 @@ struct fsmonitor_daemon_state {
struct fsmonitor_daemon_backend_data *backend_data;
struct ipc_server_data *ipc_server_data;
struct strbuf path_ipc;
};
/*