| 366 | } |
| 367 | |
| 368 | static void wt_longstatus_print_change_data(struct wt_status *s, |
| 369 | int change_type, |
| 370 | struct string_list_item *it) |
| 371 | { |
| 372 | struct wt_status_change_data *d = it->util; |
| 373 | const char *c = color(change_type, s); |
| 374 | int status; |
| 375 | char *one_name; |
| 376 | char *two_name; |
| 377 | const char *one, *two; |
| 378 | struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT; |
| 379 | struct strbuf extra = STRBUF_INIT; |
| 380 | static char *padding; |
| 381 | static int label_width; |
| 382 | const char *what; |
| 383 | int len; |
| 384 | |
| 385 | if (!padding) { |
| 386 | /* If DIFF_STATUS_* uses outside the range [A..Z], we're in trouble */ |
| 387 | label_width = maxwidth(wt_status_diff_status_string, 'A', 'Z'); |
| 388 | label_width += strlen(" "); |
| 389 | padding = xmallocz(label_width); |
| 390 | memset(padding, ' ', label_width); |
| 391 | } |
| 392 | |
| 393 | one_name = two_name = it->string; |
| 394 | switch (change_type) { |
| 395 | case WT_STATUS_UPDATED: |
| 396 | status = d->index_status; |
| 397 | break; |
| 398 | case WT_STATUS_CHANGED: |
| 399 | if (d->new_submodule_commits || d->dirty_submodule) { |
| 400 | strbuf_addstr(&extra, " ("); |
| 401 | if (d->new_submodule_commits) |
| 402 | strbuf_addstr(&extra, _("new commits, ")); |
| 403 | if (d->dirty_submodule & DIRTY_SUBMODULE_MODIFIED) |
| 404 | strbuf_addstr(&extra, _("modified content, ")); |
| 405 | if (d->dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) |
| 406 | strbuf_addstr(&extra, _("untracked content, ")); |
| 407 | strbuf_setlen(&extra, extra.len - 2); |
| 408 | strbuf_addch(&extra, ')'); |
| 409 | } |
| 410 | status = d->worktree_status; |
| 411 | break; |
| 412 | default: |
| 413 | BUG("unhandled change_type %d in wt_longstatus_print_change_data", |
| 414 | change_type); |
| 415 | } |
| 416 | |
| 417 | /* |
| 418 | * Only pick up the rename it's relevant. If the rename is for |
| 419 | * the changed section and we're printing the updated section, |
| 420 | * ignore it. |
| 421 | */ |
| 422 | if (d->rename_status == status) |
| 423 | one_name = d->rename_source; |
| 424 | |
| 425 | one = quote_path(one_name, s->prefix, &onebuf, 0); |
no test coverage detected