| 98 | "Disable this message with \"git config set advice.%s false\""); |
| 99 | |
| 100 | static void vadvise(const char *advice, int display_instructions, |
| 101 | const char *key, va_list params) |
| 102 | { |
| 103 | struct strbuf buf = STRBUF_INIT; |
| 104 | const char *cp, *np; |
| 105 | |
| 106 | strbuf_vaddf(&buf, advice, params); |
| 107 | |
| 108 | if (display_instructions) |
| 109 | strbuf_addf(&buf, turn_off_instructions, key); |
| 110 | |
| 111 | for (cp = buf.buf; *cp; cp = np) { |
| 112 | np = strchrnul(cp, '\n'); |
| 113 | fprintf(stderr, _("%shint:%s%.*s%s\n"), |
| 114 | advise_get_color(ADVICE_COLOR_HINT), |
| 115 | (np == cp) ? "" : " ", |
| 116 | (int)(np - cp), cp, |
| 117 | advise_get_color(ADVICE_COLOR_RESET)); |
| 118 | if (*np) |
| 119 | np++; |
| 120 | } |
| 121 | strbuf_release(&buf); |
| 122 | } |
| 123 | |
| 124 | void advise(const char *advice, ...) |
| 125 | { |
no test coverage detected