MCPcopy Index your code
hub / github.com/git/git / wt_longstatus_print_change_data

Function wt_longstatus_print_change_data

wt-status.c:368–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368static 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);

Callers 2

Calls 12

maxwidthFunction · 0.85
xmalloczFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_setlenFunction · 0.85
strbuf_addchFunction · 0.85
quote_pathFunction · 0.85
status_printfFunction · 0.85
utf8_strwidthFunction · 0.85
status_printf_moreFunction · 0.85
strbuf_releaseFunction · 0.85
colorFunction · 0.70

Tested by

no test coverage detected