Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 1 | #ifndef STATUS_H |
| 2 | #define STATUS_H |
| 3 | |
Kristian Høgsberg | f26a001 | 2007-09-17 20:06:42 -0400 | [diff] [blame] | 4 | #include <stdio.h> |
Junio C Hamano | 50b7e70 | 2009-08-04 23:49:33 -0700 | [diff] [blame] | 5 | #include "string-list.h" |
Junio C Hamano | 23900a9 | 2009-08-09 23:08:40 -0700 | [diff] [blame] | 6 | #include "color.h" |
SZEDER Gábor | 7aa9b9b | 2015-08-20 16:06:27 +0200 | [diff] [blame] | 7 | #include "pathspec.h" |
Kristian Høgsberg | f26a001 | 2007-09-17 20:06:42 -0400 | [diff] [blame] | 8 | |
Nguyễn Thái Ngọc Duy | 81eff27 | 2016-04-22 20:01:31 +0700 | [diff] [blame] | 9 | struct worktree; |
| 10 | |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 11 | enum color_wt_status { |
Junio C Hamano | 23900a9 | 2009-08-09 23:08:40 -0700 | [diff] [blame] | 12 | WT_STATUS_HEADER = 0, |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 13 | WT_STATUS_UPDATED, |
| 14 | WT_STATUS_CHANGED, |
| 15 | WT_STATUS_UNTRACKED, |
Chris Parsons | 950ce2e | 2008-05-22 08:50:02 -0400 | [diff] [blame] | 16 | WT_STATUS_NOBRANCH, |
Junio C Hamano | 4d4d572 | 2009-08-05 00:04:51 -0700 | [diff] [blame] | 17 | WT_STATUS_UNMERGED, |
Daniel Knittl-Frank | 05a59a0 | 2010-05-25 15:45:51 +0200 | [diff] [blame] | 18 | WT_STATUS_LOCAL_BRANCH, |
Aleksi Aalto | 1d28232 | 2010-11-18 01:40:05 +0200 | [diff] [blame] | 19 | WT_STATUS_REMOTE_BRANCH, |
| 20 | WT_STATUS_ONBRANCH, |
| 21 | WT_STATUS_MAXSLOT |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 22 | }; |
| 23 | |
Marius Storm-Olsen | 4bfee30 | 2008-06-05 10:31:19 +0200 | [diff] [blame] | 24 | enum untracked_status_type { |
Marius Storm-Olsen | 6c2ce04 | 2008-06-05 14:22:56 +0200 | [diff] [blame] | 25 | SHOW_NO_UNTRACKED_FILES, |
| 26 | SHOW_NORMAL_UNTRACKED_FILES, |
Marius Storm-Olsen | 4bfee30 | 2008-06-05 10:31:19 +0200 | [diff] [blame] | 27 | SHOW_ALL_UNTRACKED_FILES |
| 28 | }; |
Marius Storm-Olsen | 4bfee30 | 2008-06-05 10:31:19 +0200 | [diff] [blame] | 29 | |
Jay Soffian | 37f7a85 | 2011-02-19 23:12:29 -0500 | [diff] [blame] | 30 | /* from where does this commit originate */ |
| 31 | enum commit_whence { |
| 32 | FROM_COMMIT, /* normal */ |
| 33 | FROM_MERGE, /* commit came from merge */ |
| 34 | FROM_CHERRY_PICK /* commit came from cherry-pick */ |
| 35 | }; |
| 36 | |
Junio C Hamano | 50b7e70 | 2009-08-04 23:49:33 -0700 | [diff] [blame] | 37 | struct wt_status_change_data { |
| 38 | int worktree_status; |
| 39 | int index_status; |
| 40 | int stagemask; |
| 41 | char *head_path; |
Jens Lehmann | 9297f77e6 | 2010-03-08 13:53:19 +0100 | [diff] [blame] | 42 | unsigned dirty_submodule : 2; |
| 43 | unsigned new_submodule_commits : 1; |
Junio C Hamano | 50b7e70 | 2009-08-04 23:49:33 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 46 | struct wt_status { |
| 47 | int is_initial; |
| 48 | char *branch; |
| 49 | const char *reference; |
Nguyễn Thái Ngọc Duy | 15b55ae | 2013-07-14 15:35:39 +0700 | [diff] [blame] | 50 | struct pathspec pathspec; |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 51 | int verbose; |
| 52 | int amend; |
Jay Soffian | 37f7a85 | 2011-02-19 23:12:29 -0500 | [diff] [blame] | 53 | enum commit_whence whence; |
Junio C Hamano | 37d07f8 | 2007-12-12 19:09:16 -0800 | [diff] [blame] | 54 | int nowarn; |
Junio C Hamano | d249b09 | 2009-08-09 21:59:30 -0700 | [diff] [blame] | 55 | int use_color; |
Matthieu Moy | 7a76c28 | 2014-03-20 13:12:41 +0100 | [diff] [blame] | 56 | int no_gettext; |
Matthieu Moy | 2556b99 | 2013-09-06 19:43:07 +0200 | [diff] [blame] | 57 | int display_comment_prefix; |
Junio C Hamano | d249b09 | 2009-08-09 21:59:30 -0700 | [diff] [blame] | 58 | int relative_paths; |
| 59 | int submodule_summary; |
Junio C Hamano | 6cb3f6b | 2010-04-10 00:11:53 -0700 | [diff] [blame] | 60 | int show_ignored_files; |
Junio C Hamano | d249b09 | 2009-08-09 21:59:30 -0700 | [diff] [blame] | 61 | enum untracked_status_type show_untracked_files; |
Jens Lehmann | 46a958b | 2010-06-25 16:56:47 +0200 | [diff] [blame] | 62 | const char *ignore_submodule_arg; |
Aleksi Aalto | 1d28232 | 2010-11-18 01:40:05 +0200 | [diff] [blame] | 63 | char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN]; |
Jeff King | 4d2292e | 2012-05-07 15:35:03 -0400 | [diff] [blame] | 64 | unsigned colopts; |
Jeff King | 3207a3a | 2012-05-07 15:44:44 -0400 | [diff] [blame] | 65 | int null_termination; |
Jeff King | d4a6bf1 | 2012-05-07 17:09:04 -0400 | [diff] [blame] | 66 | int show_branch; |
Matthieu Moy | 6a964f5 | 2013-09-12 12:50:05 +0200 | [diff] [blame] | 67 | int hints; |
Junio C Hamano | d249b09 | 2009-08-09 21:59:30 -0700 | [diff] [blame] | 68 | |
Jürgen Rühle | 2a3a3c2 | 2007-01-10 23:25:03 +0100 | [diff] [blame] | 69 | /* These are computed during processing of the individual sections */ |
| 70 | int commitable; |
| 71 | int workdir_dirty; |
Kristian Høgsberg | 0f729f2 | 2007-09-17 20:06:43 -0400 | [diff] [blame] | 72 | const char *index_file; |
Kristian Høgsberg | f26a001 | 2007-09-17 20:06:42 -0400 | [diff] [blame] | 73 | FILE *fp; |
Johannes Schindelin | 367c988 | 2007-11-11 17:35:41 +0000 | [diff] [blame] | 74 | const char *prefix; |
Junio C Hamano | 50b7e70 | 2009-08-04 23:49:33 -0700 | [diff] [blame] | 75 | struct string_list change; |
Junio C Hamano | 7637868 | 2009-08-10 00:36:33 -0700 | [diff] [blame] | 76 | struct string_list untracked; |
Junio C Hamano | 6cb3f6b | 2010-04-10 00:11:53 -0700 | [diff] [blame] | 77 | struct string_list ignored; |
Nguyễn Thái Ngọc Duy | 6a38ef2 | 2013-03-13 19:59:16 +0700 | [diff] [blame] | 78 | uint32_t untracked_in_ms; |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 79 | }; |
| 80 | |
Lucien Kong | 83c750a | 2012-06-05 22:21:24 +0200 | [diff] [blame] | 81 | struct wt_status_state { |
| 82 | int merge_in_progress; |
| 83 | int am_in_progress; |
| 84 | int am_empty_patch; |
| 85 | int rebase_in_progress; |
| 86 | int rebase_interactive_in_progress; |
| 87 | int cherry_pick_in_progress; |
| 88 | int bisect_in_progress; |
Matthieu Moy | db4ef44 | 2013-04-02 16:20:21 +0200 | [diff] [blame] | 89 | int revert_in_progress; |
Michael J Gruber | 970399e | 2015-03-06 16:04:06 +0100 | [diff] [blame] | 90 | int detached_at; |
Nguyễn Thái Ngọc Duy | 8b87cfd | 2013-03-16 09:12:36 +0700 | [diff] [blame] | 91 | char *branch; |
| 92 | char *onto; |
Nguyễn Thái Ngọc Duy | b397ea4 | 2013-03-13 18:42:52 +0700 | [diff] [blame] | 93 | char *detached_from; |
| 94 | unsigned char detached_sha1[20]; |
Matthieu Moy | 87e139c | 2013-04-02 16:20:22 +0200 | [diff] [blame] | 95 | unsigned char revert_head_sha1[20]; |
Ralf Thielow | bffd809 | 2013-10-11 17:58:37 +0200 | [diff] [blame] | 96 | unsigned char cherry_pick_head_sha1[20]; |
Lucien Kong | 83c750a | 2012-06-05 22:21:24 +0200 | [diff] [blame] | 97 | }; |
| 98 | |
Jens Lehmann | 1a72cfd | 2013-12-05 20:44:14 +0100 | [diff] [blame] | 99 | void wt_status_truncate_message_at_cut_line(struct strbuf *); |
Nguyễn Thái Ngọc Duy | fcef931 | 2014-02-17 19:15:31 +0700 | [diff] [blame] | 100 | void wt_status_add_cut_line(FILE *fp); |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 101 | void wt_status_prepare(struct wt_status *s); |
| 102 | void wt_status_print(struct wt_status *s); |
Junio C Hamano | 7637868 | 2009-08-10 00:36:33 -0700 | [diff] [blame] | 103 | void wt_status_collect(struct wt_status *s); |
Nguyễn Thái Ngọc Duy | b397ea4 | 2013-03-13 18:42:52 +0700 | [diff] [blame] | 104 | void wt_status_get_state(struct wt_status_state *state, int get_detached_from); |
Nguyễn Thái Ngọc Duy | 81eff27 | 2016-04-22 20:01:31 +0700 | [diff] [blame] | 105 | int wt_status_check_rebase(const struct worktree *wt, |
| 106 | struct wt_status_state *state); |
Nguyễn Thái Ngọc Duy | f5d067a | 2016-04-22 20:01:34 +0700 | [diff] [blame] | 107 | int wt_status_check_bisect(const struct worktree *wt, |
| 108 | struct wt_status_state *state); |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 109 | |
Jeff King | d4a6bf1 | 2012-05-07 17:09:04 -0400 | [diff] [blame] | 110 | void wt_shortstatus_print(struct wt_status *s); |
Jeff King | 3207a3a | 2012-05-07 15:44:44 -0400 | [diff] [blame] | 111 | void wt_porcelain_print(struct wt_status *s); |
Michael J Gruber | 84dbe7b | 2009-12-05 16:04:37 +0100 | [diff] [blame] | 112 | |
Jeff King | 8dd0ee8 | 2013-07-09 20:23:28 -0400 | [diff] [blame] | 113 | __attribute__((format (printf, 3, 4))) |
| 114 | void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...); |
| 115 | __attribute__((format (printf, 3, 4))) |
| 116 | void status_printf(struct wt_status *s, const char *color, const char *fmt, ...); |
Jonathan Nieder | becbdae | 2011-02-25 23:09:41 -0600 | [diff] [blame] | 117 | |
Jeff King | c91f0d9 | 2006-09-08 04:05:34 -0400 | [diff] [blame] | 118 | #endif /* STATUS_H */ |