@@ -267,16 +267,13 @@ static int read_graft_file(struct repository *r, const char *graft_file)
struct strbuf buf = STRBUF_INIT;
if (!fp)
return -1;
- if (!no_graft_file_deprecated_advice &&
- advice_enabled(ADVICE_GRAFT_FILE_DEPRECATED))
- advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
- "and will be removed in a future Git version.\n"
- "\n"
- "Please use \"git replace --convert-graft-file\"\n"
- "to convert the grafts into replace refs.\n"
- "\n"
- "Turn this message off by running\n"
- "\"git config advice.graftFileDeprecated false\""));
+ if (!no_graft_file_deprecated_advice)
+ advise_if_enabled(ADVICE_GRAFT_FILE_DEPRECATED,
+ _("Support for <GIT_DIR>/info/grafts is deprecated\n"
+ "and will be removed in a future Git version.\n"
+ "\n"
+ "Please use \"git replace --convert-graft-file\"\n"
+ "to convert the grafts into replace refs.\n"));
while (!strbuf_getwholeline(&buf, fp, '\n')) {
/* The format is just "Commit Parent1 Parent2 ...\n" */
struct commit_graft *graft = read_graft_line(&buf);
We have a deprecation notice in `read_graft_file()` since f9f99b3f7d (Deprecate support for .git/info/grafts, 2018-04-29). This deprecation notice is shown using `advice_enabled()` plus `advise()`. Let's use the `advise_if_enabled()` API which combines the functionality of both APIs and offers some advantages, such as: standardizing the presentation of the help on how to disable the advice. The test we have in t6001 "show advice that grafts are deprecated" does not need to be adjusted due to the changes in this step. Signed-off-by: Rubén Justo <rjusto@gmail.com> --- commit.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)