Skip to content

Commit 8821e90

Browse files
avargitster
authored andcommitted
advice: don't pointlessly suggest --convert-graft-file
The advice to run 'git replace --convert-graft-file' added in f9f99b3 ("Deprecate support for .git/info/grafts", 2018-04-29) didn't add an exception for the 'git replace --convert-graft-file' codepath itself. As a result we'd suggest running --convert-graft-file while the user was running --convert-graft-file, which makes no sense. Before: $ git replace --convert-graft-file hint: Support for <GIT_DIR>/info/grafts is deprecated hint: and will be removed in a future Git version. hint: hint: Please use "git replace --convert-graft-file" hint: to convert the grafts into replace refs. hint: hint: Turn this message off by running hint: "git config advice.graftFileDeprecated false" Add a check for that case and skip printing the advice while the user is busy following our advice. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98cdfbb commit 8821e90

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/replace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ static int convert_graft_file(int force)
495495
if (!fp)
496496
return -1;
497497

498+
advice_graft_file_deprecated = 0;
498499
while (strbuf_getline(&buf, fp) != EOF) {
499500
if (*buf.buf == '#')
500501
continue;

t/t6050-replace.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,10 @@ test_expect_success '--convert-graft-file' '
461461
printf "%s\n%s %s\n\n# comment\n%s\n" \
462462
$(git rev-parse HEAD^^ HEAD^ HEAD^^ HEAD^2) \
463463
>.git/info/grafts &&
464-
git replace --convert-graft-file &&
464+
git status 2>stderr &&
465+
test_i18ngrep "hint:.*grafts is deprecated" stderr &&
466+
git replace --convert-graft-file 2>stderr &&
467+
test_i18ngrep ! "hint:.*grafts is deprecated" stderr &&
465468
test_path_is_missing .git/info/grafts &&
466469
467470
: verify that the history is now "grafted" &&

0 commit comments

Comments
 (0)