]> git.ipfire.org Git - thirdparty/git.git/commitdiff
advice: don't pointlessly suggest --convert-graft-file
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 27 Nov 2018 20:12:55 +0000 (21:12 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Nov 2018 06:15:17 +0000 (15:15 +0900)
The advice to run 'git replace --convert-graft-file' added in
f9f99b3f7d ("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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/replace.c
t/t6050-replace.sh

index 17868a92dcfccce335d69854f54f0ef5d3a9ca1b..6adc4f594fe94d67f1f944137da2b3e1071665e1 100644 (file)
@@ -495,6 +495,7 @@ static int convert_graft_file(int force)
        if (!fp)
                return -1;
 
+       advice_graft_file_deprecated = 0;
        while (strbuf_getline(&buf, fp) != EOF) {
                if (*buf.buf == '#')
                        continue;
index 86374a9c52c0bd26a8ba7223526c9e1f128f468a..5d6d3184ac390f2cd476a322cf6d15e69a912494 100755 (executable)
@@ -461,7 +461,10 @@ test_expect_success '--convert-graft-file' '
        printf "%s\n%s %s\n\n# comment\n%s\n" \
                $(git rev-parse HEAD^^ HEAD^ HEAD^^ HEAD^2) \
                >.git/info/grafts &&
-       git replace --convert-graft-file &&
+       git status 2>stderr &&
+       test_i18ngrep "hint:.*grafts is deprecated" stderr &&
+       git replace --convert-graft-file 2>stderr &&
+       test_i18ngrep ! "hint:.*grafts is deprecated" stderr &&
        test_path_is_missing .git/info/grafts &&
 
        : verify that the history is now "grafted" &&