Skip to content

Commit 4df1ff0

Browse files
jeffhostetlerdscho
authored andcommitted
status: rename long-format print routines
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 00f27fe commit 4df1ff0

File tree

3 files changed

+58
-58
lines changed

3 files changed

+58
-58
lines changed

builtin/commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
515515
break;
516516
case STATUS_FORMAT_NONE:
517517
case STATUS_FORMAT_LONG:
518-
wt_status_print(s);
518+
wt_longstatus_print(s);
519519
break;
520520
}
521521

@@ -1403,7 +1403,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
14031403
case STATUS_FORMAT_LONG:
14041404
s.verbose = verbose;
14051405
s.ignore_submodule_arg = ignore_submodule_arg;
1406-
wt_status_print(&s);
1406+
wt_longstatus_print(&s);
14071407
break;
14081408
}
14091409
return 0;

wt-status.c

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void wt_status_prepare(struct wt_status *s)
139139
s->display_comment_prefix = 0;
140140
}
141141

142-
static void wt_status_print_unmerged_header(struct wt_status *s)
142+
static void wt_longstatus_print_unmerged_header(struct wt_status *s)
143143
{
144144
int i;
145145
int del_mod_conflict = 0;
@@ -191,7 +191,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
191191
status_printf_ln(s, c, "%s", "");
192192
}
193193

194-
static void wt_status_print_cached_header(struct wt_status *s)
194+
static void wt_longstatus_print_cached_header(struct wt_status *s)
195195
{
196196
const char *c = color(WT_STATUS_HEADER, s);
197197

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

210-
static void wt_status_print_dirty_header(struct wt_status *s,
211-
int has_deleted,
212-
int has_dirty_submodules)
210+
static void wt_longstatus_print_dirty_header(struct wt_status *s,
211+
int has_deleted,
212+
int has_dirty_submodules)
213213
{
214214
const char *c = color(WT_STATUS_HEADER, s);
215215

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

229-
static void wt_status_print_other_header(struct wt_status *s,
230-
const char *what,
231-
const char *how)
229+
static void wt_longstatus_print_other_header(struct wt_status *s,
230+
const char *what,
231+
const char *how)
232232
{
233233
const char *c = color(WT_STATUS_HEADER, s);
234234
status_printf_ln(s, c, "%s:", what);
@@ -238,7 +238,7 @@ static void wt_status_print_other_header(struct wt_status *s,
238238
status_printf_ln(s, c, "%s", "");
239239
}
240240

241-
static void wt_status_print_trailer(struct wt_status *s)
241+
static void wt_longstatus_print_trailer(struct wt_status *s)
242242
{
243243
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
244244
}
@@ -304,8 +304,8 @@ static int maxwidth(const char *(*label)(int), int minval, int maxval)
304304
return result;
305305
}
306306

307-
static void wt_status_print_unmerged_data(struct wt_status *s,
308-
struct string_list_item *it)
307+
static void wt_longstatus_print_unmerged_data(struct wt_status *s,
308+
struct string_list_item *it)
309309
{
310310
const char *c = color(WT_STATUS_UNMERGED, s);
311311
struct wt_status_change_data *d = it->util;
@@ -331,9 +331,9 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
331331
strbuf_release(&onebuf);
332332
}
333333

334-
static void wt_status_print_change_data(struct wt_status *s,
335-
int change_type,
336-
struct string_list_item *it)
334+
static void wt_longstatus_print_change_data(struct wt_status *s,
335+
int change_type,
336+
struct string_list_item *it)
337337
{
338338
struct wt_status_change_data *d = it->util;
339339
const char *c = color(change_type, s);
@@ -378,7 +378,7 @@ static void wt_status_print_change_data(struct wt_status *s,
378378
status = d->worktree_status;
379379
break;
380380
default:
381-
die("BUG: unhandled change_type %d in wt_status_print_change_data",
381+
die("BUG: unhandled change_type %d in wt_longstatus_print_change_data",
382382
change_type);
383383
}
384384

@@ -626,7 +626,7 @@ void wt_status_collect(struct wt_status *s)
626626
wt_status_collect_untracked(s);
627627
}
628628

629-
static void wt_status_print_unmerged(struct wt_status *s)
629+
static void wt_longstatus_print_unmerged(struct wt_status *s)
630630
{
631631
int shown_header = 0;
632632
int i;
@@ -639,17 +639,17 @@ static void wt_status_print_unmerged(struct wt_status *s)
639639
if (!d->stagemask)
640640
continue;
641641
if (!shown_header) {
642-
wt_status_print_unmerged_header(s);
642+
wt_longstatus_print_unmerged_header(s);
643643
shown_header = 1;
644644
}
645-
wt_status_print_unmerged_data(s, it);
645+
wt_longstatus_print_unmerged_data(s, it);
646646
}
647647
if (shown_header)
648-
wt_status_print_trailer(s);
648+
wt_longstatus_print_trailer(s);
649649

650650
}
651651

652-
static void wt_status_print_updated(struct wt_status *s)
652+
static void wt_longstatus_print_updated(struct wt_status *s)
653653
{
654654
int shown_header = 0;
655655
int i;
@@ -663,14 +663,14 @@ static void wt_status_print_updated(struct wt_status *s)
663663
d->index_status == DIFF_STATUS_UNMERGED)
664664
continue;
665665
if (!shown_header) {
666-
wt_status_print_cached_header(s);
666+
wt_longstatus_print_cached_header(s);
667667
s->commitable = 1;
668668
shown_header = 1;
669669
}
670-
wt_status_print_change_data(s, WT_STATUS_UPDATED, it);
670+
wt_longstatus_print_change_data(s, WT_STATUS_UPDATED, it);
671671
}
672672
if (shown_header)
673-
wt_status_print_trailer(s);
673+
wt_longstatus_print_trailer(s);
674674
}
675675

676676
/*
@@ -702,15 +702,15 @@ static int wt_status_check_worktree_changes(struct wt_status *s,
702702
return changes;
703703
}
704704

705-
static void wt_status_print_changed(struct wt_status *s)
705+
static void wt_longstatus_print_changed(struct wt_status *s)
706706
{
707707
int i, dirty_submodules;
708708
int worktree_changes = wt_status_check_worktree_changes(s, &dirty_submodules);
709709

710710
if (!worktree_changes)
711711
return;
712712

713-
wt_status_print_dirty_header(s, worktree_changes < 0, dirty_submodules);
713+
wt_longstatus_print_dirty_header(s, worktree_changes < 0, dirty_submodules);
714714

715715
for (i = 0; i < s->change.nr; i++) {
716716
struct wt_status_change_data *d;
@@ -720,12 +720,12 @@ static void wt_status_print_changed(struct wt_status *s)
720720
if (!d->worktree_status ||
721721
d->worktree_status == DIFF_STATUS_UNMERGED)
722722
continue;
723-
wt_status_print_change_data(s, WT_STATUS_CHANGED, it);
723+
wt_longstatus_print_change_data(s, WT_STATUS_CHANGED, it);
724724
}
725-
wt_status_print_trailer(s);
725+
wt_longstatus_print_trailer(s);
726726
}
727727

728-
static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitted)
728+
static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncommitted)
729729
{
730730
struct child_process sm_summary = CHILD_PROCESS_INIT;
731731
struct strbuf cmd_stdout = STRBUF_INIT;
@@ -771,10 +771,10 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
771771
strbuf_release(&summary);
772772
}
773773

774-
static void wt_status_print_other(struct wt_status *s,
775-
struct string_list *l,
776-
const char *what,
777-
const char *how)
774+
static void wt_longstatus_print_other(struct wt_status *s,
775+
struct string_list *l,
776+
const char *what,
777+
const char *how)
778778
{
779779
int i;
780780
struct strbuf buf = STRBUF_INIT;
@@ -784,7 +784,7 @@ static void wt_status_print_other(struct wt_status *s,
784784
if (!l->nr)
785785
return;
786786

787-
wt_status_print_other_header(s, what, how);
787+
wt_longstatus_print_other_header(s, what, how);
788788

789789
for (i = 0; i < l->nr; i++) {
790790
struct string_list_item *it;
@@ -844,7 +844,7 @@ void wt_status_add_cut_line(FILE *fp)
844844
strbuf_release(&buf);
845845
}
846846

847-
static void wt_status_print_verbose(struct wt_status *s)
847+
static void wt_longstatus_print_verbose(struct wt_status *s)
848848
{
849849
struct rev_info rev;
850850
struct setup_revision_opt opt;
@@ -877,7 +877,7 @@ static void wt_status_print_verbose(struct wt_status *s)
877877
if (s->verbose > 1 && s->commitable) {
878878
/* print_updated() printed a header, so do we */
879879
if (s->fp != stdout)
880-
wt_status_print_trailer(s);
880+
wt_longstatus_print_trailer(s);
881881
status_printf_ln(s, c, _("Changes to be committed:"));
882882
rev.diffopt.a_prefix = "c/";
883883
rev.diffopt.b_prefix = "i/";
@@ -895,7 +895,7 @@ static void wt_status_print_verbose(struct wt_status *s)
895895
}
896896
}
897897

898-
static void wt_status_print_tracking(struct wt_status *s)
898+
static void wt_longstatus_print_tracking(struct wt_status *s)
899899
{
900900
struct strbuf sb = STRBUF_INIT;
901901
const char *cp, *ep, *branch_name;
@@ -958,7 +958,7 @@ static void show_merge_in_progress(struct wt_status *s,
958958
status_printf_ln(s, color,
959959
_(" (use \"git commit\" to conclude merge)"));
960960
}
961-
wt_status_print_trailer(s);
961+
wt_longstatus_print_trailer(s);
962962
}
963963

964964
static void show_am_in_progress(struct wt_status *s,
@@ -979,7 +979,7 @@ static void show_am_in_progress(struct wt_status *s,
979979
status_printf_ln(s, color,
980980
_(" (use \"git am --abort\" to restore the original branch)"));
981981
}
982-
wt_status_print_trailer(s);
982+
wt_longstatus_print_trailer(s);
983983
}
984984

985985
static char *read_line_from_git_path(const char *filename)
@@ -1203,7 +1203,7 @@ static void show_rebase_in_progress(struct wt_status *s,
12031203
_(" (use \"git rebase --continue\" once you are satisfied with your changes)"));
12041204
}
12051205
}
1206-
wt_status_print_trailer(s);
1206+
wt_longstatus_print_trailer(s);
12071207
}
12081208

12091209
static void show_cherry_pick_in_progress(struct wt_status *s,
@@ -1222,7 +1222,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
12221222
status_printf_ln(s, color,
12231223
_(" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)"));
12241224
}
1225-
wt_status_print_trailer(s);
1225+
wt_longstatus_print_trailer(s);
12261226
}
12271227

12281228
static void show_revert_in_progress(struct wt_status *s,
@@ -1241,7 +1241,7 @@ static void show_revert_in_progress(struct wt_status *s,
12411241
status_printf_ln(s, color,
12421242
_(" (use \"git revert --abort\" to cancel the revert operation)"));
12431243
}
1244-
wt_status_print_trailer(s);
1244+
wt_longstatus_print_trailer(s);
12451245
}
12461246

12471247
static void show_bisect_in_progress(struct wt_status *s,
@@ -1258,7 +1258,7 @@ static void show_bisect_in_progress(struct wt_status *s,
12581258
if (s->hints)
12591259
status_printf_ln(s, color,
12601260
_(" (use \"git bisect reset\" to get back to the original branch)"));
1261-
wt_status_print_trailer(s);
1261+
wt_longstatus_print_trailer(s);
12621262
}
12631263

12641264
/*
@@ -1428,8 +1428,8 @@ void wt_status_get_state(struct wt_status_state *state,
14281428
wt_status_get_detached_from(state);
14291429
}
14301430

1431-
static void wt_status_print_state(struct wt_status *s,
1432-
struct wt_status_state *state)
1431+
static void wt_longstatus_print_state(struct wt_status *s,
1432+
struct wt_status_state *state)
14331433
{
14341434
const char *state_color = color(WT_STATUS_HEADER, s);
14351435
if (state->merge_in_progress)
@@ -1446,7 +1446,7 @@ static void wt_status_print_state(struct wt_status *s,
14461446
show_bisect_in_progress(s, state, state_color);
14471447
}
14481448

1449-
void wt_status_print(struct wt_status *s)
1449+
void wt_longstatus_print(struct wt_status *s)
14501450
{
14511451
const char *branch_color = color(WT_STATUS_ONBRANCH, s);
14521452
const char *branch_status_color = color(WT_STATUS_HEADER, s);
@@ -1483,10 +1483,10 @@ void wt_status_print(struct wt_status *s)
14831483
status_printf_more(s, branch_status_color, "%s", on_what);
14841484
status_printf_more(s, branch_color, "%s\n", branch_name);
14851485
if (!s->is_initial)
1486-
wt_status_print_tracking(s);
1486+
wt_longstatus_print_tracking(s);
14871487
}
14881488

1489-
wt_status_print_state(s, &state);
1489+
wt_longstatus_print_state(s, &state);
14901490
free(state.branch);
14911491
free(state.onto);
14921492
free(state.detached_from);
@@ -1497,19 +1497,19 @@ void wt_status_print(struct wt_status *s)
14971497
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
14981498
}
14991499

1500-
wt_status_print_updated(s);
1501-
wt_status_print_unmerged(s);
1502-
wt_status_print_changed(s);
1500+
wt_longstatus_print_updated(s);
1501+
wt_longstatus_print_unmerged(s);
1502+
wt_longstatus_print_changed(s);
15031503
if (s->submodule_summary &&
15041504
(!s->ignore_submodule_arg ||
15051505
strcmp(s->ignore_submodule_arg, "all"))) {
1506-
wt_status_print_submodule_summary(s, 0); /* staged */
1507-
wt_status_print_submodule_summary(s, 1); /* unstaged */
1506+
wt_longstatus_print_submodule_summary(s, 0); /* staged */
1507+
wt_longstatus_print_submodule_summary(s, 1); /* unstaged */
15081508
}
15091509
if (s->show_untracked_files) {
1510-
wt_status_print_other(s, &s->untracked, _("Untracked files"), "add");
1510+
wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
15111511
if (s->show_ignored_files)
1512-
wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
1512+
wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
15131513
if (advice_status_u_option && 2000 < s->untracked_in_ms) {
15141514
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
15151515
status_printf_ln(s, GIT_COLOR_NORMAL,
@@ -1524,7 +1524,7 @@ void wt_status_print(struct wt_status *s)
15241524
? _(" (use -u option to show untracked files)") : "");
15251525

15261526
if (s->verbose)
1527-
wt_status_print_verbose(s);
1527+
wt_longstatus_print_verbose(s);
15281528
if (!s->commitable) {
15291529
if (s->amend)
15301530
status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));

wt-status.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ struct wt_status_state {
9999
void wt_status_truncate_message_at_cut_line(struct strbuf *);
100100
void wt_status_add_cut_line(FILE *fp);
101101
void wt_status_prepare(struct wt_status *s);
102-
void wt_status_print(struct wt_status *s);
103102
void wt_status_collect(struct wt_status *s);
104103
void wt_status_get_state(struct wt_status_state *state, int get_detached_from);
105104
int wt_status_check_rebase(const struct worktree *wt,
106105
struct wt_status_state *state);
107106
int wt_status_check_bisect(const struct worktree *wt,
108107
struct wt_status_state *state);
109108

109+
void wt_longstatus_print(struct wt_status *s);
110110
void wt_shortstatus_print(struct wt_status *s);
111111
void wt_porcelain_print(struct wt_status *s);
112112

0 commit comments

Comments
 (0)