# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
# The hook is passed a version (currently 1) and a time in nanoseconds
# formatted as a string and outputs to stdout all files that have been
# modified since the given time. Paths must be relative to the root of
# the working tree and separated by a single NUL.
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
my ($version, $time) = @ARGV;
# Check the hook interface version
# convert nanoseconds to seconds
$time = int $time / 1000000000;
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$git_work_tree = Win32::GetCwd();
$git_work_tree =~ tr/\\/\//;
$git_work_tree = Cwd::cwd();