Message ID | b915b95cc2f82728e3f5f7135f041a709a74ce5d.1646160213.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Commit | 1a9241e1fee9d418e436849853f031329e792192 |
Headers | show |
Series | Builtin FSMonitor Part 2 | expand |
On Tue, Mar 01 2022, Jeff Hostetler via GitGitGadget wrote: > From: Jeff Hostetler <jeffhost@microsoft.com> > > Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> > Signed-off-by: Junio C Hamano <gitster@pobox.com> > --- > builtin/update-index.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/builtin/update-index.c b/builtin/update-index.c > index 876112abb21..d335f1ac72a 100644 > --- a/builtin/update-index.c > +++ b/builtin/update-index.c > @@ -1238,18 +1238,18 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) > if (fsmonitor > 0) { > enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r); > if (fsm_mode == FSMONITOR_MODE_DISABLED) { > - warning(_("core.fsmonitor is unset; " > - "set it if you really want to " > - "enable fsmonitor")); > + advise(_("core.fsmonitor is unset; " > + "set it if you really want to " > + "enable fsmonitor")); > } > add_fsmonitor(&the_index); > report(_("fsmonitor enabled")); > } else if (!fsmonitor) { > enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r); > if (fsm_mode > FSMONITOR_MODE_DISABLED) > - warning(_("core.fsmonitor is set; " > - "remove it if you really want to " > - "disable fsmonitor")); > + advise(_("core.fsmonitor is set; " > + "remove it if you really want to " > + "disable fsmonitor")); > remove_fsmonitor(&the_index); > report(_("fsmonitor disabled")); > } For any new advice you should: * Add it to advice.[ch] * Add it to Documentation/config/advise.txt * This should use advise_if_enabled() with the relevant enum you add (which should also be documented in the *.txt) I'm not oppposed to this change per-se, but I think this narrow change makes the post-image of builtin/update-index.c worse. Why are we issuing an advice() only for this config, but not changing the other two uses of warning()? In the post-image: 6 matches for "\(advise\|warning\)" in buffer: update-index.c 1195: warning(_("core.splitIndex is set to false; " 1204: warning(_("core.splitIndex is set to true; " 1216: warning(_("core.untrackedCache is set to true; " 1228: warning(_("core.untrackedCache is set to false; " 1241: advise(_("core.fsmonitor is unset; " 1250: advise(_("core.fsmonitor is set; " We should either leave these alone, or give them all the treatment of adding a new advise.updateIndexConfig or whatever, and have them all use advise_if_enabled(ADVICE_UPDATE_INDEX_CONFIG, ...). Also these existing messages seem really confusing both for the fsmonitor & others. We're telling the user "do XYZ to disable ABC", but then right afterwards we say "ABC disabled" via report()?
diff --git a/builtin/update-index.c b/builtin/update-index.c index 876112abb21..d335f1ac72a 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1238,18 +1238,18 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) if (fsmonitor > 0) { enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r); if (fsm_mode == FSMONITOR_MODE_DISABLED) { - warning(_("core.fsmonitor is unset; " - "set it if you really want to " - "enable fsmonitor")); + advise(_("core.fsmonitor is unset; " + "set it if you really want to " + "enable fsmonitor")); } add_fsmonitor(&the_index); report(_("fsmonitor enabled")); } else if (!fsmonitor) { enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r); if (fsm_mode > FSMONITOR_MODE_DISABLED) - warning(_("core.fsmonitor is set; " - "remove it if you really want to " - "disable fsmonitor")); + advise(_("core.fsmonitor is set; " + "remove it if you really want to " + "disable fsmonitor")); remove_fsmonitor(&the_index); report(_("fsmonitor disabled")); }