Skip to content

Commit dd77cf6

Browse files
jeffhostetlergitster
authored andcommitted
help: include fsmonitor--daemon feature flag in version info
Add the "feature: fsmonitor--daemon" message to the output of `git version --build-options`. The builtin FSMonitor is only available on certain platforms and even then only when certain Makefile flags are enabled, so print a message in the verbose version output when it is available. This can be used by test scripts for prereq testing. Granted, tests could just try `git fsmonitor--daemon status` and look for a 128 exit code or grep for a "not supported" message on stderr, but these methods are rather obscure. The main advantage is that the feature message will automatically appear in bug reports and other support requests. This concept was also used during the development of Scalar for similar reasons. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 518a522 commit dd77cf6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

help.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "refs.h"
1313
#include "parse-options.h"
1414
#include "prompt.h"
15+
#include "fsmonitor-ipc.h"
1516

1617
struct category_description {
1718
uint32_t category;
@@ -695,6 +696,9 @@ void get_version_info(struct strbuf *buf, int show_build_options)
695696
strbuf_addf(buf, "sizeof-size_t: %d\n", (int)sizeof(size_t));
696697
strbuf_addf(buf, "shell-path: %s\n", SHELL_PATH);
697698
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
699+
700+
if (fsmonitor_ipc__is_supported())
701+
strbuf_addstr(buf, "feature: fsmonitor--daemon\n");
698702
}
699703
}
700704

t/test-lib.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,3 +1799,10 @@ test_lazy_prereq SHA1 '
17991799
# Tests that verify the scheduler integration must set this locally
18001800
# to avoid errors.
18011801
GIT_TEST_MAINT_SCHEDULER="none:exit 1"
1802+
1803+
# Does this platform support `git fsmonitor--daemon`
1804+
#
1805+
test_lazy_prereq FSMONITOR_DAEMON '
1806+
git version --build-options >output &&
1807+
grep "feature: fsmonitor--daemon" output
1808+
'

0 commit comments

Comments
 (0)