Skip to content

Commit

Permalink
status: rename long-format print routines
Browse files Browse the repository at this point in the history
Rename the various wt_status_print*() routines to be
wt_longstatus_print*() to make it clear that these
routines are only concerned with the normal/long
status output and reduce developer confusion as other
status formats are added in the future.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
jeffhostetler authored and gitster committed Aug 5, 2016
1 parent f8f7adc commit 957a0fe
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
break;
case STATUS_FORMAT_NONE:
case STATUS_FORMAT_LONG:
wt_status_print(s);
wt_longstatus_print(s);
break;
}

Expand Down Expand Up @@ -1403,7 +1403,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
case STATUS_FORMAT_LONG:
s.verbose = verbose;
s.ignore_submodule_arg = ignore_submodule_arg;
wt_status_print(&s);
wt_longstatus_print(&s);
break;
}
return 0;
Expand Down
110 changes: 55 additions & 55 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void wt_status_prepare(struct wt_status *s)
s->display_comment_prefix = 0;
}

static void wt_status_print_unmerged_header(struct wt_status *s)
static void wt_longstatus_print_unmerged_header(struct wt_status *s)
{
int i;
int del_mod_conflict = 0;
Expand Down Expand Up @@ -191,7 +191,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
status_printf_ln(s, c, "%s", "");
}

static void wt_status_print_cached_header(struct wt_status *s)
static void wt_longstatus_print_cached_header(struct wt_status *s)
{
const char *c = color(WT_STATUS_HEADER, s);

Expand All @@ -207,9 +207,9 @@ static void wt_status_print_cached_header(struct wt_status *s)
status_printf_ln(s, c, "%s", "");
}

static void wt_status_print_dirty_header(struct wt_status *s,
int has_deleted,
int has_dirty_submodules)
static void wt_longstatus_print_dirty_header(struct wt_status *s,
int has_deleted,
int has_dirty_submodules)
{
const char *c = color(WT_STATUS_HEADER, s);

Expand All @@ -226,9 +226,9 @@ static void wt_status_print_dirty_header(struct wt_status *s,
status_printf_ln(s, c, "%s", "");
}

static void wt_status_print_other_header(struct wt_status *s,
const char *what,
const char *how)
static void wt_longstatus_print_other_header(struct wt_status *s,
const char *what,
const char *how)
{
const char *c = color(WT_STATUS_HEADER, s);
status_printf_ln(s, c, "%s:", what);
Expand All @@ -238,7 +238,7 @@ static void wt_status_print_other_header(struct wt_status *s,
status_printf_ln(s, c, "%s", "");
}

static void wt_status_print_trailer(struct wt_status *s)
static void wt_longstatus_print_trailer(struct wt_status *s)
{
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
}
Expand Down Expand Up @@ -304,8 +304,8 @@ static int maxwidth(const char *(*label)(int), int minval, int maxval)
return result;
}

static void wt_status_print_unmerged_data(struct wt_status *s,
struct string_list_item *it)
static void wt_longstatus_print_unmerged_data(struct wt_status *s,
struct string_list_item *it)
{
const char *c = color(WT_STATUS_UNMERGED, s);
struct wt_status_change_data *d = it->util;
Expand All @@ -331,9 +331,9 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
strbuf_release(&onebuf);
}

static void wt_status_print_change_data(struct wt_status *s,
int change_type,
struct string_list_item *it)
static void wt_longstatus_print_change_data(struct wt_status *s,
int change_type,
struct string_list_item *it)
{
struct wt_status_change_data *d = it->util;
const char *c = color(change_type, s);
Expand Down Expand Up @@ -378,7 +378,7 @@ static void wt_status_print_change_data(struct wt_status *s,
status = d->worktree_status;
break;
default:
die("BUG: unhandled change_type %d in wt_status_print_change_data",
die("BUG: unhandled change_type %d in wt_longstatus_print_change_data",
change_type);
}

Expand Down Expand Up @@ -627,7 +627,7 @@ void wt_status_collect(struct wt_status *s)
wt_status_collect_untracked(s);
}

static void wt_status_print_unmerged(struct wt_status *s)
static void wt_longstatus_print_unmerged(struct wt_status *s)
{
int shown_header = 0;
int i;
Expand All @@ -640,17 +640,17 @@ static void wt_status_print_unmerged(struct wt_status *s)
if (!d->stagemask)
continue;
if (!shown_header) {
wt_status_print_unmerged_header(s);
wt_longstatus_print_unmerged_header(s);
shown_header = 1;
}
wt_status_print_unmerged_data(s, it);
wt_longstatus_print_unmerged_data(s, it);
}
if (shown_header)
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);

}

static void wt_status_print_updated(struct wt_status *s)
static void wt_longstatus_print_updated(struct wt_status *s)
{
int shown_header = 0;
int i;
Expand All @@ -664,14 +664,14 @@ static void wt_status_print_updated(struct wt_status *s)
d->index_status == DIFF_STATUS_UNMERGED)
continue;
if (!shown_header) {
wt_status_print_cached_header(s);
wt_longstatus_print_cached_header(s);
s->commitable = 1;
shown_header = 1;
}
wt_status_print_change_data(s, WT_STATUS_UPDATED, it);
wt_longstatus_print_change_data(s, WT_STATUS_UPDATED, it);
}
if (shown_header)
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

/*
Expand Down Expand Up @@ -703,15 +703,15 @@ static int wt_status_check_worktree_changes(struct wt_status *s,
return changes;
}

static void wt_status_print_changed(struct wt_status *s)
static void wt_longstatus_print_changed(struct wt_status *s)
{
int i, dirty_submodules;
int worktree_changes = wt_status_check_worktree_changes(s, &dirty_submodules);

if (!worktree_changes)
return;

wt_status_print_dirty_header(s, worktree_changes < 0, dirty_submodules);
wt_longstatus_print_dirty_header(s, worktree_changes < 0, dirty_submodules);

for (i = 0; i < s->change.nr; i++) {
struct wt_status_change_data *d;
Expand All @@ -721,12 +721,12 @@ static void wt_status_print_changed(struct wt_status *s)
if (!d->worktree_status ||
d->worktree_status == DIFF_STATUS_UNMERGED)
continue;
wt_status_print_change_data(s, WT_STATUS_CHANGED, it);
wt_longstatus_print_change_data(s, WT_STATUS_CHANGED, it);
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitted)
static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncommitted)
{
struct child_process sm_summary = CHILD_PROCESS_INIT;
struct strbuf cmd_stdout = STRBUF_INIT;
Expand Down Expand Up @@ -772,10 +772,10 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
strbuf_release(&summary);
}

static void wt_status_print_other(struct wt_status *s,
struct string_list *l,
const char *what,
const char *how)
static void wt_longstatus_print_other(struct wt_status *s,
struct string_list *l,
const char *what,
const char *how)
{
int i;
struct strbuf buf = STRBUF_INIT;
Expand All @@ -785,7 +785,7 @@ static void wt_status_print_other(struct wt_status *s,
if (!l->nr)
return;

wt_status_print_other_header(s, what, how);
wt_longstatus_print_other_header(s, what, how);

for (i = 0; i < l->nr; i++) {
struct string_list_item *it;
Expand Down Expand Up @@ -845,7 +845,7 @@ void wt_status_add_cut_line(FILE *fp)
strbuf_release(&buf);
}

static void wt_status_print_verbose(struct wt_status *s)
static void wt_longstatus_print_verbose(struct wt_status *s)
{
struct rev_info rev;
struct setup_revision_opt opt;
Expand Down Expand Up @@ -878,7 +878,7 @@ static void wt_status_print_verbose(struct wt_status *s)
if (s->verbose > 1 && s->commitable) {
/* print_updated() printed a header, so do we */
if (s->fp != stdout)
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
status_printf_ln(s, c, _("Changes to be committed:"));
rev.diffopt.a_prefix = "c/";
rev.diffopt.b_prefix = "i/";
Expand All @@ -896,7 +896,7 @@ static void wt_status_print_verbose(struct wt_status *s)
}
}

static void wt_status_print_tracking(struct wt_status *s)
static void wt_longstatus_print_tracking(struct wt_status *s)
{
struct strbuf sb = STRBUF_INIT;
const char *cp, *ep, *branch_name;
Expand Down Expand Up @@ -959,7 +959,7 @@ static void show_merge_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (use \"git commit\" to conclude merge)"));
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static void show_am_in_progress(struct wt_status *s,
Expand All @@ -980,7 +980,7 @@ static void show_am_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (use \"git am --abort\" to restore the original branch)"));
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static char *read_line_from_git_path(const char *filename)
Expand Down Expand Up @@ -1204,7 +1204,7 @@ static void show_rebase_in_progress(struct wt_status *s,
_(" (use \"git rebase --continue\" once you are satisfied with your changes)"));
}
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static void show_cherry_pick_in_progress(struct wt_status *s,
Expand All @@ -1223,7 +1223,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)"));
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static void show_revert_in_progress(struct wt_status *s,
Expand All @@ -1242,7 +1242,7 @@ static void show_revert_in_progress(struct wt_status *s,
status_printf_ln(s, color,
_(" (use \"git revert --abort\" to cancel the revert operation)"));
}
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

static void show_bisect_in_progress(struct wt_status *s,
Expand All @@ -1259,7 +1259,7 @@ static void show_bisect_in_progress(struct wt_status *s,
if (s->hints)
status_printf_ln(s, color,
_(" (use \"git bisect reset\" to get back to the original branch)"));
wt_status_print_trailer(s);
wt_longstatus_print_trailer(s);
}

/*
Expand Down Expand Up @@ -1429,8 +1429,8 @@ void wt_status_get_state(struct wt_status_state *state,
wt_status_get_detached_from(state);
}

static void wt_status_print_state(struct wt_status *s,
struct wt_status_state *state)
static void wt_longstatus_print_state(struct wt_status *s,
struct wt_status_state *state)
{
const char *state_color = color(WT_STATUS_HEADER, s);
if (state->merge_in_progress)
Expand All @@ -1447,7 +1447,7 @@ static void wt_status_print_state(struct wt_status *s,
show_bisect_in_progress(s, state, state_color);
}

void wt_status_print(struct wt_status *s)
void wt_longstatus_print(struct wt_status *s)
{
const char *branch_color = color(WT_STATUS_ONBRANCH, s);
const char *branch_status_color = color(WT_STATUS_HEADER, s);
Expand Down Expand Up @@ -1484,10 +1484,10 @@ void wt_status_print(struct wt_status *s)
status_printf_more(s, branch_status_color, "%s", on_what);
status_printf_more(s, branch_color, "%s\n", branch_name);
if (!s->is_initial)
wt_status_print_tracking(s);
wt_longstatus_print_tracking(s);
}

wt_status_print_state(s, &state);
wt_longstatus_print_state(s, &state);
free(state.branch);
free(state.onto);
free(state.detached_from);
Expand All @@ -1498,19 +1498,19 @@ void wt_status_print(struct wt_status *s)
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
}

wt_status_print_updated(s);
wt_status_print_unmerged(s);
wt_status_print_changed(s);
wt_longstatus_print_updated(s);
wt_longstatus_print_unmerged(s);
wt_longstatus_print_changed(s);
if (s->submodule_summary &&
(!s->ignore_submodule_arg ||
strcmp(s->ignore_submodule_arg, "all"))) {
wt_status_print_submodule_summary(s, 0); /* staged */
wt_status_print_submodule_summary(s, 1); /* unstaged */
wt_longstatus_print_submodule_summary(s, 0); /* staged */
wt_longstatus_print_submodule_summary(s, 1); /* unstaged */
}
if (s->show_untracked_files) {
wt_status_print_other(s, &s->untracked, _("Untracked files"), "add");
wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
if (s->show_ignored_files)
wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
if (advice_status_u_option && 2000 < s->untracked_in_ms) {
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
status_printf_ln(s, GIT_COLOR_NORMAL,
Expand All @@ -1525,7 +1525,7 @@ void wt_status_print(struct wt_status *s)
? _(" (use -u option to show untracked files)") : "");

if (s->verbose)
wt_status_print_verbose(s);
wt_longstatus_print_verbose(s);
if (!s->commitable) {
if (s->amend)
status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));
Expand Down
2 changes: 1 addition & 1 deletion wt-status.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ struct wt_status_state {
void wt_status_truncate_message_at_cut_line(struct strbuf *);
void wt_status_add_cut_line(FILE *fp);
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect(struct wt_status *s);
void wt_status_get_state(struct wt_status_state *state, int get_detached_from);
int wt_status_check_rebase(const struct worktree *wt,
struct wt_status_state *state);
int wt_status_check_bisect(const struct worktree *wt,
struct wt_status_state *state);

void wt_longstatus_print(struct wt_status *s);
void wt_shortstatus_print(struct wt_status *s);
void wt_porcelain_print(struct wt_status *s);

Expand Down

0 comments on commit 957a0fe

Please sign in to comment.