I'm happy with this now. The only things left are applying ewah on the watch index extension and maybe improve lookup performance a bit. The former needs jk/pack-bitmap graduated. The latter is not urgent. Oh and maybe address "BUGS" section (more like known limitations) in git-file-watcher.txt.
For early adopters that fear a buggy file-watcher may cause update loss, set GIT_TEST_WATCHED=1 (or 2). It'll do lstat() to verify file-watcher results (so no perf. gain). Beware of race condition that may lead to false positives, mentioned in 20/26 (maybe I should do something about it). The series can also be fetched from https://github.com/pclouds/git.git file-watcher Nguyễn Thái Ngọc Duy (26): pkt-line.c: rename global variable buffer to something less generic pkt-line.c: add packet_write_timeout() pkt-line.c: add packet_read_line_timeout() unix-socket: make unlink() optional in unix_stream_listen() Add git-file-watcher and basic connection handling logic file-watcher: check socket directory permission file-watcher: remove socket on exit file-watcher: add --detach read-cache: save trailing sha-1 read-cache: new flag CE_WATCHED to mark what file is watched Clear CE_WATCHED when set CE_VALID alone read-cache: basic hand shaking to the file watcher read-cache: ask file watcher to watch files read-cache: put some limits on file watching read-cache: get changed file list from file watcher git-compat-util.h: add inotify stubs on non-Linux platforms file-watcher: inotify support, watching part file-watcher: inotify support, notification part Wrap CE_VALID test with ce_valid() read-cache: new variable to verify file-watcher results Support running file watcher with the test suite file-watcher: quit if $WATCHER/socket is gone file-watcher: tests for the daemon ls-files: print CE_WATCHED as W (or "w" with CE_VALID) file-watcher: tests for the client side Disable file-watcher with system inotify on some tests .gitignore | 2 + Documentation/config.txt | 19 + Documentation/git-file-watcher.txt (new) | 54 ++ Documentation/git-ls-files.txt | 1 + Documentation/technical/index-format.txt | 9 + Makefile | 3 + builtin/grep.c | 2 +- builtin/ls-files.c | 14 +- builtin/update-index.c | 12 +- cache.h | 17 + config.mak.uname | 1 + credential-cache--daemon.c | 2 +- daemon.c | 30 +- diff-lib.c | 4 +- diff.c | 2 +- file-watcher-lib.c (new) | 321 +++++++++ file-watcher-lib.h (new) | 8 + file-watcher.c (new) | 1149 ++++++++++++++++++++++++++++++ git-compat-util.h | 43 ++ pkt-line.c | 61 +- pkt-line.h | 2 + read-cache.c | 119 +++- setup.c | 25 + t/t1011-read-tree-sparse-checkout.sh | 2 + t/t2104-update-index-skip-worktree.sh | 2 + t/t7011-skip-worktree-reading.sh | 2 + t/t7012-skip-worktree-writing.sh | 2 + t/t7513-file-watcher.sh (new +x) | 382 ++++++++++ t/t7514-file-watcher-lib.sh (new +x) | 190 +++++ test-file-watcher.c (new) | 111 +++ unix-socket.c | 5 +- unix-socket.h | 2 +- unpack-trees.c | 2 +- wrapper.c | 47 ++ 34 files changed, 2591 insertions(+), 56 deletions(-) create mode 100644 Documentation/git-file-watcher.txt create mode 100644 file-watcher-lib.c create mode 100644 file-watcher-lib.h create mode 100644 file-watcher.c create mode 100755 t/t7513-file-watcher.sh create mode 100755 t/t7514-file-watcher-lib.sh create mode 100644 test-file-watcher.c -- 220.127.116.11.240.g8478abd -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html