Skip to content

Commit 4818da1

Browse files
jeffhostetlerGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge branch 'try-v4-fsmonitor-part3' into try-v4-fsmonitor
2 parents 5d925ba + 5643509 commit 4818da1

23 files changed

+3704
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
/git-format-patch
7373
/git-fsck
7474
/git-fsck-objects
75+
/git-fsmonitor--daemon
7576
/git-gc
7677
/git-get-tar-commit-id
7778
/git-grep
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
git-fsmonitor--daemon(1)
2+
========================
3+
4+
NAME
5+
----
6+
git-fsmonitor--daemon - A Built-in File System Monitor
7+
8+
SYNOPSIS
9+
--------
10+
[verse]
11+
'git fsmonitor--daemon' start
12+
'git fsmonitor--daemon' run
13+
'git fsmonitor--daemon' stop
14+
'git fsmonitor--daemon' status
15+
16+
DESCRIPTION
17+
-----------
18+
19+
A daemon to watch the working directory for file and directory
20+
changes using platform-specific file system notification facilities.
21+
22+
This daemon communicates directly with commands like `git status`
23+
using the link:technical/api-simple-ipc.html[simple IPC] interface
24+
instead of the slower linkgit:githooks[5] interface.
25+
26+
This daemon is built into Git so that no third-party tools are
27+
required.
28+
29+
OPTIONS
30+
-------
31+
32+
start::
33+
Starts a daemon in the background.
34+
35+
run::
36+
Runs a daemon in the foreground.
37+
38+
stop::
39+
Stops the daemon running in the current working
40+
directory, if present.
41+
42+
status::
43+
Exits with zero status if a daemon is watching the
44+
current working directory.
45+
46+
REMARKS
47+
-------
48+
49+
This daemon is a long running process used to watch a single working
50+
directory and maintain a list of the recently changed files and
51+
directories. Performance of commands such as `git status` can be
52+
increased if they just ask for a summary of changes to the working
53+
directory and can avoid scanning the disk.
54+
55+
When `core.useBuiltinFSMonitor` is set to `true` (see
56+
linkgit:git-config[1]) commands, such as `git status`, will ask the
57+
daemon for changes and automatically start it (if necessary).
58+
59+
For more information see the "File System Monitor" section in
60+
linkgit:git-update-index[1].
61+
62+
CAVEATS
63+
-------
64+
65+
The fsmonitor daemon does not currently know about submodules and does
66+
not know to filter out file system events that happen within a
67+
submodule. If fsmonitor daemon is watching a super repo and a file is
68+
modified within the working directory of a submodule, it will report
69+
the change (as happening against the super repo). However, the client
70+
will properly ignore these extra events, so performance may be affected
71+
but it will not cause an incorrect result.
72+
73+
GIT
74+
---
75+
Part of the linkgit:git[1] suite

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ all::
465465
# directory, and the JSON compilation database 'compile_commands.json' will be
466466
# created at the root of the repository.
467467
#
468+
# If your platform supports a built-in fsmonitor backend, set
469+
# FSMONITOR_DAEMON_BACKEND to the "<name>" of the corresponding
470+
# `compat/fsmonitor/fsm-listen-<name>.c` that implements the
471+
# `fsm_listen__*()` routines.
472+
#
468473
# Define DEVELOPER to enable more compiler warnings. Compiler version
469474
# and family are auto detected, but could be overridden by defining
470475
# COMPILER_FEATURES (see config.mak.dev). You can still set
@@ -706,6 +711,7 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
706711
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
707712
TEST_BUILTINS_OBJS += test-example-decorate.o
708713
TEST_BUILTINS_OBJS += test-fast-rebase.o
714+
TEST_BUILTINS_OBJS += test-fsmonitor-client.o
709715
TEST_BUILTINS_OBJS += test-genrandom.o
710716
TEST_BUILTINS_OBJS += test-genzeros.o
711717
TEST_BUILTINS_OBJS += test-getcwd.o
@@ -1106,6 +1112,7 @@ BUILTIN_OBJS += builtin/fmt-merge-msg.o
11061112
BUILTIN_OBJS += builtin/for-each-ref.o
11071113
BUILTIN_OBJS += builtin/for-each-repo.o
11081114
BUILTIN_OBJS += builtin/fsck.o
1115+
BUILTIN_OBJS += builtin/fsmonitor--daemon.o
11091116
BUILTIN_OBJS += builtin/gc.o
11101117
BUILTIN_OBJS += builtin/get-tar-commit-id.o
11111118
BUILTIN_OBJS += builtin/grep.o
@@ -1931,6 +1938,11 @@ ifdef NEED_ACCESS_ROOT_HANDLER
19311938
COMPAT_OBJS += compat/access.o
19321939
endif
19331940

1941+
ifdef FSMONITOR_DAEMON_BACKEND
1942+
COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
1943+
COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
1944+
endif
1945+
19341946
ifeq ($(TCLTK_PATH),)
19351947
NO_TCLTK = NoThanks
19361948
endif
@@ -2813,6 +2825,9 @@ GIT-BUILD-OPTIONS: FORCE
28132825
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
28142826
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
28152827
@echo X=\'$(X)\' >>$@+
2828+
ifdef FSMONITOR_DAEMON_BACKEND
2829+
@echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
2830+
endif
28162831
ifdef TEST_OUTPUT_DIRECTORY
28172832
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
28182833
endif

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix);
159159
int cmd_for_each_repo(int argc, const char **argv, const char *prefix);
160160
int cmd_format_patch(int argc, const char **argv, const char *prefix);
161161
int cmd_fsck(int argc, const char **argv, const char *prefix);
162+
int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix);
162163
int cmd_gc(int argc, const char **argv, const char *prefix);
163164
int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
164165
int cmd_grep(int argc, const char **argv, const char *prefix);

0 commit comments

Comments
 (0)