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 <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff Hostetler committed
Aug 5, 2016 at 18:00 UTC
957a0fe2e59343f10f10620fab787f7e5abf3ab8
3 files changed
+58
-58
builtin/commit.c
+2
-2
@@ -515,7 +515,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
515
break;
516
case STATUS_FORMAT_NONE:
517
case STATUS_FORMAT_LONG:
518
- wt_status_print(s);
518
+ wt_longstatus_print(s);
519
break;
520
}
521
@@ -1403,7 +1403,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1403
case STATUS_FORMAT_LONG:
1404
s.verbose = verbose;
1405
s.ignore_submodule_arg = ignore_submodule_arg;
1406
- wt_status_print(&s);
1406
+ wt_longstatus_print(&s);
1407
break;
1408
}
1409
return 0;
wt-status.c
+55
-55
@@ -139,7 +139,7 @@ void wt_status_prepare(struct wt_status *s)
139
s->display_comment_prefix = 0;
140
}
141
142
-static void wt_status_print_unmerged_header(struct wt_status *s)
142
+static void wt_longstatus_print_unmerged_header(struct wt_status *s)
143
{
144
int i;
145
int del_mod_conflict = 0;
@@ -191,7 +191,7 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
191
status_printf_ln(s, c, "%s", "");
192
}
193
194
-static void wt_status_print_cached_header(struct wt_status *s)
194
+static void wt_longstatus_print_cached_header(struct wt_status *s)
195
{
196
const char *c = color(WT_STATUS_HEADER, s);
197
@@ -207,9 +207,9 @@ static void wt_status_print_cached_header(struct wt_status *s)
207
status_printf_ln(s, c, "%s", "");
208
}
209
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)
213
{
214
const char *c = color(WT_STATUS_HEADER, s);
215
@@ -226,9 +226,9 @@ static void wt_status_print_dirty_header(struct wt_status *s,
226
status_printf_ln(s, c, "%s", "");
227
}
228
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)
232
{
233
const char *c = color(WT_STATUS_HEADER, s);
234
status_printf_ln(s, c, "%s:", what);
@@ -238,7 +238,7 @@ static void wt_status_print_other_header(struct wt_status *s,
238
status_printf_ln(s, c, "%s", "");
239
}
240
241
-static void wt_status_print_trailer(struct wt_status *s)
241
+static void wt_longstatus_print_trailer(struct wt_status *s)
242
{
243
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
244
}
@@ -304,8 +304,8 @@ static int maxwidth(const char *(*label)(int), int minval, int maxval)
304
return result;
305
}
306
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)
309
{
310
const char *c = color(WT_STATUS_UNMERGED, s);
311
struct wt_status_change_data *d = it->util;
@@ -331,9 +331,9 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
331
strbuf_release(&onebuf);
332
}
333
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)
337
{
338
struct wt_status_change_data *d = it->util;
339
const char *c = color(change_type, s);
@@ -378,7 +378,7 @@ static void wt_status_print_change_data(struct wt_status *s,
378
status = d->worktree_status;
379
break;
380
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",
382
change_type);
383
}
384
@@ -627,7 +627,7 @@ void wt_status_collect(struct wt_status *s)
627
wt_status_collect_untracked(s);
628
}
629
630
-static void wt_status_print_unmerged(struct wt_status *s)
630
+static void wt_longstatus_print_unmerged(struct wt_status *s)
631
{
632
int shown_header = 0;
633
int i;
@@ -640,17 +640,17 @@ static void wt_status_print_unmerged(struct wt_status *s)
640
if (!d->stagemask)
641
continue;
642
if (!shown_header) {
643
- wt_status_print_unmerged_header(s);
643
+ wt_longstatus_print_unmerged_header(s);
644
shown_header = 1;
645
}
646
- wt_status_print_unmerged_data(s, it);
646
+ wt_longstatus_print_unmerged_data(s, it);
647
}
648
if (shown_header)
649
- wt_status_print_trailer(s);
649
+ wt_longstatus_print_trailer(s);
650
651
}
652
653
-static void wt_status_print_updated(struct wt_status *s)
653
+static void wt_longstatus_print_updated(struct wt_status *s)
654
{
655
int shown_header = 0;
656
int i;
@@ -664,14 +664,14 @@ static void wt_status_print_updated(struct wt_status *s)
664
d->index_status == DIFF_STATUS_UNMERGED)
665
continue;
666
if (!shown_header) {
667
- wt_status_print_cached_header(s);
667
+ wt_longstatus_print_cached_header(s);
668
s->commitable = 1;
669
shown_header = 1;
670
}
671
- wt_status_print_change_data(s, WT_STATUS_UPDATED, it);
671
+ wt_longstatus_print_change_data(s, WT_STATUS_UPDATED, it);
672
}
673
if (shown_header)
674
- wt_status_print_trailer(s);
674
+ wt_longstatus_print_trailer(s);
675
}
676
677
/*
@@ -703,7 +703,7 @@ static int wt_status_check_worktree_changes(struct wt_status *s,
703
return changes;
704
}
705
706
-static void wt_status_print_changed(struct wt_status *s)
706
+static void wt_longstatus_print_changed(struct wt_status *s)
707
{
708
int i, dirty_submodules;
709
int worktree_changes = wt_status_check_worktree_changes(s, &dirty_submodules);
@@ -711,7 +711,7 @@ static void wt_status_print_changed(struct wt_status *s)
711
if (!worktree_changes)
712
return;
713
714
- wt_status_print_dirty_header(s, worktree_changes < 0, dirty_submodules);
714
+ wt_longstatus_print_dirty_header(s, worktree_changes < 0, dirty_submodules);
715
716
for (i = 0; i < s->change.nr; i++) {
717
struct wt_status_change_data *d;
@@ -721,12 +721,12 @@ static void wt_status_print_changed(struct wt_status *s)
721
if (!d->worktree_status ||
722
d->worktree_status == DIFF_STATUS_UNMERGED)
723
continue;
724
- wt_status_print_change_data(s, WT_STATUS_CHANGED, it);
724
+ wt_longstatus_print_change_data(s, WT_STATUS_CHANGED, it);
725
}
726
- wt_status_print_trailer(s);
726
+ wt_longstatus_print_trailer(s);
727
}
728
729
-static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitted)
729
+static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncommitted)
730
{
731
struct child_process sm_summary = CHILD_PROCESS_INIT;
732
struct strbuf cmd_stdout = STRBUF_INIT;
@@ -772,10 +772,10 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
772
strbuf_release(&summary);
773
}
774
775
-static void wt_status_print_other(struct wt_status *s,
776
- struct string_list *l,
777
- const char *what,
778
- const char *how)
775
+static void wt_longstatus_print_other(struct wt_status *s,
776
+ struct string_list *l,
777
+ const char *what,
778
+ const char *how)
779
{
780
int i;
781
struct strbuf buf = STRBUF_INIT;
@@ -785,7 +785,7 @@ static void wt_status_print_other(struct wt_status *s,
785
if (!l->nr)
786
return;
787
788
- wt_status_print_other_header(s, what, how);
788
+ wt_longstatus_print_other_header(s, what, how);
789
790
for (i = 0; i < l->nr; i++) {
791
struct string_list_item *it;
@@ -845,7 +845,7 @@ void wt_status_add_cut_line(FILE *fp)
845
strbuf_release(&buf);
846
}
847
848
-static void wt_status_print_verbose(struct wt_status *s)
848
+static void wt_longstatus_print_verbose(struct wt_status *s)
849
{
850
struct rev_info rev;
851
struct setup_revision_opt opt;
@@ -878,7 +878,7 @@ static void wt_status_print_verbose(struct wt_status *s)
878
if (s->verbose > 1 && s->commitable) {
879
/* print_updated() printed a header, so do we */
880
if (s->fp != stdout)
881
- wt_status_print_trailer(s);
881
+ wt_longstatus_print_trailer(s);
882
status_printf_ln(s, c, _("Changes to be committed:"));
883
rev.diffopt.a_prefix = "c/";
884
rev.diffopt.b_prefix = "i/";
@@ -896,7 +896,7 @@ static void wt_status_print_verbose(struct wt_status *s)
896
}
897
}
898
899
-static void wt_status_print_tracking(struct wt_status *s)
899
+static void wt_longstatus_print_tracking(struct wt_status *s)
900
{
901
struct strbuf sb = STRBUF_INIT;
902
const char *cp, *ep, *branch_name;
@@ -959,7 +959,7 @@ static void show_merge_in_progress(struct wt_status *s,
959
status_printf_ln(s, color,
960
_(" (use \"git commit\" to conclude merge)"));
961
}
962
- wt_status_print_trailer(s);
962
+ wt_longstatus_print_trailer(s);
963
}
964
965
static void show_am_in_progress(struct wt_status *s,
@@ -980,7 +980,7 @@ static void show_am_in_progress(struct wt_status *s,
980
status_printf_ln(s, color,
981
_(" (use \"git am --abort\" to restore the original branch)"));
982
}
983
- wt_status_print_trailer(s);
983
+ wt_longstatus_print_trailer(s);
984
}
985
986
static char *read_line_from_git_path(const char *filename)
@@ -1204,7 +1204,7 @@ static void show_rebase_in_progress(struct wt_status *s,
1204
_(" (use \"git rebase --continue\" once you are satisfied with your changes)"));
1205
}
1206
}
1207
- wt_status_print_trailer(s);
1207
+ wt_longstatus_print_trailer(s);
1208
}
1209
1210
static void show_cherry_pick_in_progress(struct wt_status *s,
@@ -1223,7 +1223,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
1223
status_printf_ln(s, color,
1224
_(" (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)"));
1225
}
1226
- wt_status_print_trailer(s);
1226
+ wt_longstatus_print_trailer(s);
1227
}
1228
1229
static void show_revert_in_progress(struct wt_status *s,
@@ -1242,7 +1242,7 @@ static void show_revert_in_progress(struct wt_status *s,
1242
status_printf_ln(s, color,
1243
_(" (use \"git revert --abort\" to cancel the revert operation)"));
1244
}
1245
- wt_status_print_trailer(s);
1245
+ wt_longstatus_print_trailer(s);
1246
}
1247
1248
static void show_bisect_in_progress(struct wt_status *s,
@@ -1259,7 +1259,7 @@ static void show_bisect_in_progress(struct wt_status *s,
1259
if (s->hints)
1260
status_printf_ln(s, color,
1261
_(" (use \"git bisect reset\" to get back to the original branch)"));
1262
- wt_status_print_trailer(s);
1262
+ wt_longstatus_print_trailer(s);
1263
}
1264
1265
/*
@@ -1429,8 +1429,8 @@ void wt_status_get_state(struct wt_status_state *state,
1429
wt_status_get_detached_from(state);
1430
}
1431
1432
-static void wt_status_print_state(struct wt_status *s,
1433
- struct wt_status_state *state)
1432
+static void wt_longstatus_print_state(struct wt_status *s,
1433
+ struct wt_status_state *state)
1434
{
1435
const char *state_color = color(WT_STATUS_HEADER, s);
1436
if (state->merge_in_progress)
@@ -1447,7 +1447,7 @@ static void wt_status_print_state(struct wt_status *s,
1447
show_bisect_in_progress(s, state, state_color);
1448
}
1449
1450
-void wt_status_print(struct wt_status *s)
1450
+void wt_longstatus_print(struct wt_status *s)
1451
{
1452
const char *branch_color = color(WT_STATUS_ONBRANCH, s);
1453
const char *branch_status_color = color(WT_STATUS_HEADER, s);
@@ -1484,10 +1484,10 @@ void wt_status_print(struct wt_status *s)
1484
status_printf_more(s, branch_status_color, "%s", on_what);
1485
status_printf_more(s, branch_color, "%s\n", branch_name);
1486
if (!s->is_initial)
1487
- wt_status_print_tracking(s);
1487
+ wt_longstatus_print_tracking(s);
1488
}
1489
1490
- wt_status_print_state(s, &state);
1490
+ wt_longstatus_print_state(s, &state);
1491
free(state.branch);
1492
free(state.onto);
1493
free(state.detached_from);
@@ -1498,19 +1498,19 @@ void wt_status_print(struct wt_status *s)
1498
status_printf_ln(s, color(WT_STATUS_HEADER, s), "%s", "");
1499
}
1500
1501
- wt_status_print_updated(s);
1502
- wt_status_print_unmerged(s);
1503
- wt_status_print_changed(s);
1501
+ wt_longstatus_print_updated(s);
1502
+ wt_longstatus_print_unmerged(s);
1503
+ wt_longstatus_print_changed(s);
1504
if (s->submodule_summary &&
1505
(!s->ignore_submodule_arg ||
1506
strcmp(s->ignore_submodule_arg, "all"))) {
1507
- wt_status_print_submodule_summary(s, 0); /* staged */
1508
- wt_status_print_submodule_summary(s, 1); /* unstaged */
1507
+ wt_longstatus_print_submodule_summary(s, 0); /* staged */
1508
+ wt_longstatus_print_submodule_summary(s, 1); /* unstaged */
1509
}
1510
if (s->show_untracked_files) {
1511
- wt_status_print_other(s, &s->untracked, _("Untracked files"), "add");
1511
+ wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
1512
if (s->show_ignored_files)
1513
- wt_status_print_other(s, &s->ignored, _("Ignored files"), "add -f");
1513
+ wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
1514
if (advice_status_u_option && 2000 < s->untracked_in_ms) {
1515
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
1516
status_printf_ln(s, GIT_COLOR_NORMAL,
@@ -1525,7 +1525,7 @@ void wt_status_print(struct wt_status *s)
1525
? _(" (use -u option to show untracked files)") : "");
1526
1527
if (s->verbose)
1528
- wt_status_print_verbose(s);
1528
+ wt_longstatus_print_verbose(s);
1529
if (!s->commitable) {
1530
if (s->amend)
1531
status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));
wt-status.h
+1
-1
@@ -99,7 +99,6 @@ struct wt_status_state {
99
void wt_status_truncate_message_at_cut_line(struct strbuf *);
100
void wt_status_add_cut_line(FILE *fp);
101
void wt_status_prepare(struct wt_status *s);
102
-void wt_status_print(struct wt_status *s);
102
void wt_status_collect(struct wt_status *s);
103
void wt_status_get_state(struct wt_status_state *state, int get_detached_from);
104
int wt_status_check_rebase(const struct worktree *wt,
@@ -107,6 +106,7 @@ int wt_status_check_rebase(const struct worktree *wt,
106
int wt_status_check_bisect(const struct worktree *wt,
107
struct wt_status_state *state);
108
109
+void wt_longstatus_print(struct wt_status *s);
110
void wt_shortstatus_print(struct wt_status *s);
111
void wt_porcelain_print(struct wt_status *s);
112