| 1215 | } |
| 1216 | |
| 1217 | static void wt_longstatus_print_tracking(struct wt_status *s) |
| 1218 | { |
| 1219 | struct strbuf sb = STRBUF_INIT; |
| 1220 | const char *cp, *ep, *branch_name; |
| 1221 | struct branch *branch; |
| 1222 | uint64_t t_begin = 0; |
| 1223 | |
| 1224 | assert(s->branch && !s->is_initial); |
| 1225 | if (!skip_prefix(s->branch, "refs/heads/", &branch_name)) |
| 1226 | return; |
| 1227 | branch = branch_get(branch_name); |
| 1228 | |
| 1229 | t_begin = getnanotime(); |
| 1230 | |
| 1231 | if (!format_tracking_info(branch, &sb, s->ahead_behind_flags, |
| 1232 | !s->commit_template)) |
| 1233 | return; |
| 1234 | |
| 1235 | if (advice_enabled(ADVICE_STATUS_AHEAD_BEHIND_WARNING) && |
| 1236 | s->ahead_behind_flags == AHEAD_BEHIND_FULL) { |
| 1237 | uint64_t t_delta_in_ms = (getnanotime() - t_begin) / 1000000; |
| 1238 | if (t_delta_in_ms > AB_DELAY_WARNING_IN_MS) { |
| 1239 | strbuf_addf(&sb, _("\n" |
| 1240 | "It took %.2f seconds to compute the branch ahead/behind values.\n" |
| 1241 | "You can use '--no-ahead-behind' to avoid this.\n"), |
| 1242 | t_delta_in_ms / 1000.0); |
| 1243 | } |
| 1244 | } |
| 1245 | |
| 1246 | for (cp = sb.buf; (ep = strchr(cp, '\n')) != NULL; cp = ep + 1) |
| 1247 | color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), |
| 1248 | "%s%s%.*s", |
| 1249 | s->display_comment_prefix ? comment_line_str : "", |
| 1250 | s->display_comment_prefix ? " " : "", |
| 1251 | (int)(ep - cp), cp); |
| 1252 | if (s->display_comment_prefix) |
| 1253 | color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%s", |
| 1254 | comment_line_str); |
| 1255 | else |
| 1256 | fputs("\n", s->fp); |
| 1257 | strbuf_release(&sb); |
| 1258 | } |
| 1259 | |
| 1260 | static int uf_was_slow(struct wt_status *s) |
| 1261 | { |
no test coverage detected