Skip to content

Commit a9bfc01

Browse files
jeffhostetlerdscho
authored andcommitted
fixup! fsmonitor--daemon: implement 'stop' and 'status' commands
This reverts commit 1866a62. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 7fbbac3 commit a9bfc01

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

builtin/fsmonitor--daemon.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,10 @@
77
#include "khash.h"
88

99
static const char * const builtin_fsmonitor__daemon_usage[] = {
10-
N_("git fsmonitor--daemon stop"),
11-
N_("git fsmonitor--daemon status"),
1210
NULL
1311
};
1412

1513
#ifdef HAVE_FSMONITOR_DAEMON_BACKEND
16-
/*
17-
* Acting as a CLIENT.
18-
*
19-
* Send a "quit" command to the `git-fsmonitor--daemon` (if running)
20-
* and wait for it to shutdown.
21-
*/
22-
static int do_as_client__send_stop(void)
23-
{
24-
struct strbuf answer = STRBUF_INIT;
25-
int ret;
26-
27-
ret = fsmonitor_ipc__send_command("quit", &answer);
28-
29-
/* The quit command does not return any response data. */
30-
strbuf_release(&answer);
31-
32-
if (ret)
33-
return ret;
34-
35-
trace2_region_enter("fsm_client", "polling-for-daemon-exit", NULL);
36-
while (fsmonitor_ipc__get_state() == IPC_STATE__LISTENING)
37-
sleep_millisec(50);
38-
trace2_region_leave("fsm_client", "polling-for-daemon-exit", NULL);
39-
40-
return 0;
41-
}
42-
43-
static int do_as_client__status(void)
44-
{
45-
enum ipc_active_state state = fsmonitor_ipc__get_state();
46-
47-
switch (state) {
48-
case IPC_STATE__LISTENING:
49-
printf(_("fsmonitor-daemon is watching '%s'\n"),
50-
the_repository->worktree);
51-
return 0;
52-
53-
default:
54-
printf(_("fsmonitor-daemon is not watching '%s'\n"),
55-
the_repository->worktree);
56-
return 1;
57-
}
58-
}
5914

6015
int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
6116
{
@@ -80,12 +35,6 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
8035
argc = parse_options(argc, argv, prefix, options,
8136
builtin_fsmonitor__daemon_usage, 0);
8237

83-
if (!strcmp(subcmd, "stop"))
84-
return !!do_as_client__send_stop();
85-
86-
if (!strcmp(subcmd, "status"))
87-
return !!do_as_client__status();
88-
8938
die(_("Unhandled subcommand '%s'"), subcmd);
9039
}
9140

0 commit comments

Comments
 (0)