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