Merge branch 'ab/replace-graft-with-replace-advice'
authorJunio C Hamano <gitster@pobox.com>
Sat, 1 Dec 2018 12:41:42 +0000 (21:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 1 Dec 2018 12:41:42 +0000 (21:41 +0900)
The advice message to tell the user to migrate an existing graft
file to the replace system when a graft file was read was shown
even when "git replace --convert-graft-file" command, which is the
way the message suggests to use, was running, which made little
sense.

* ab/replace-graft-with-replace-advice:
advice: don't pointlessly suggest --convert-graft-file

builtin/replace.c
t/t6050-replace.sh
index a58b9c6d130568602ac7928bd1da4a83724ff4f1..affcdfb4169899c2affee51593f0453d5d9b9add 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" &&