diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2016-08-05 18:00:27 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-05 15:46:08 -0700 |
commit | be7e795efe35d3e50199af5452b218e5121b1713 (patch) | |
tree | d02d84c4e67161e2a97aa55d7c448467806aa4f2 /wt-status.h | |
parent | 957a0fe2e59343f10f10620fab787f7e5abf3ab8 (diff) | |
download | git-be7e795efe35d3e50199af5452b218e5121b1713.tar.gz |
status: cleanup API to wt_status_print
Refactor the API between builtin/commit.c and wt-status.[ch].
Hide the details of the various wt_*status_print() routines inside
wt-status.c behind a single (new) wt_status_print() routine.
Eliminate the switch statements from builtin/commit.c.
Allow details of new status formats to be isolated within wt-status.c
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.h')
-rw-r--r-- | wt-status.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/wt-status.h b/wt-status.h index 2023a3cef6..9389076f69 100644 --- a/wt-status.h +++ b/wt-status.h @@ -43,6 +43,15 @@ struct wt_status_change_data { unsigned new_submodule_commits : 1; }; +enum wt_status_format { + STATUS_FORMAT_NONE = 0, + STATUS_FORMAT_LONG, + STATUS_FORMAT_SHORT, + STATUS_FORMAT_PORCELAIN, + + STATUS_FORMAT_UNSPECIFIED +}; + struct wt_status { int is_initial; char *branch; @@ -66,6 +75,8 @@ struct wt_status { int show_branch; int hints; + enum wt_status_format status_format; + /* These are computed during processing of the individual sections */ int commitable; int workdir_dirty; @@ -99,6 +110,7 @@ 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, @@ -106,10 +118,6 @@ int wt_status_check_rebase(const struct worktree *wt, 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); - __attribute__((format (printf, 3, 4))) void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...); __attribute__((format (printf, 3, 4))) |