🌐 AI搜索 & 代理 主页
blob: c9b3b744e923f2f559f64f1bf4a1f2159b5060d6 [file] [log] [blame]
Jeff Kingc91f0d92006-09-08 08:05:341#ifndef STATUS_H
2#define STATUS_H
3
Kristian Høgsbergf26a0012007-09-18 00:06:424#include <stdio.h>
Junio C Hamano50b7e702009-08-05 06:49:335#include "string-list.h"
Junio C Hamano23900a92009-08-10 06:08:406#include "color.h"
SZEDER Gábor7aa9b9b2015-08-20 14:06:277#include "pathspec.h"
Kristian Høgsbergf26a0012007-09-18 00:06:428
Jeff Kingc91f0d92006-09-08 08:05:349enum color_wt_status {
Junio C Hamano23900a92009-08-10 06:08:4010 WT_STATUS_HEADER = 0,
Jeff Kingc91f0d92006-09-08 08:05:3411 WT_STATUS_UPDATED,
12 WT_STATUS_CHANGED,
13 WT_STATUS_UNTRACKED,
Chris Parsons950ce2e2008-05-22 12:50:0214 WT_STATUS_NOBRANCH,
Junio C Hamano4d4d5722009-08-05 07:04:5115 WT_STATUS_UNMERGED,
Daniel Knittl-Frank05a59a02010-05-25 13:45:5116 WT_STATUS_LOCAL_BRANCH,
Aleksi Aalto1d282322010-11-17 23:40:0517 WT_STATUS_REMOTE_BRANCH,
18 WT_STATUS_ONBRANCH,
19 WT_STATUS_MAXSLOT
Jeff Kingc91f0d92006-09-08 08:05:3420};
21
Marius Storm-Olsen4bfee302008-06-05 08:31:1922enum untracked_status_type {
Marius Storm-Olsen6c2ce042008-06-05 12:22:5623 SHOW_NO_UNTRACKED_FILES,
24 SHOW_NORMAL_UNTRACKED_FILES,
Marius Storm-Olsen4bfee302008-06-05 08:31:1925 SHOW_ALL_UNTRACKED_FILES
26};
Marius Storm-Olsen4bfee302008-06-05 08:31:1927
Jay Soffian37f7a852011-02-20 04:12:2928/* from where does this commit originate */
29enum commit_whence {
30 FROM_COMMIT, /* normal */
31 FROM_MERGE, /* commit came from merge */
32 FROM_CHERRY_PICK /* commit came from cherry-pick */
33};
34
Junio C Hamano50b7e702009-08-05 06:49:3335struct wt_status_change_data {
36 int worktree_status;
37 int index_status;
38 int stagemask;
39 char *head_path;
Jens Lehmann9297f77e62010-03-08 12:53:1940 unsigned dirty_submodule : 2;
41 unsigned new_submodule_commits : 1;
Junio C Hamano50b7e702009-08-05 06:49:3342};
43
Jeff Kingc91f0d92006-09-08 08:05:3444struct wt_status {
45 int is_initial;
46 char *branch;
47 const char *reference;
Nguyễn Thái Ngọc Duy15b55ae2013-07-14 08:35:3948 struct pathspec pathspec;
Jeff Kingc91f0d92006-09-08 08:05:3449 int verbose;
50 int amend;
Jay Soffian37f7a852011-02-20 04:12:2951 enum commit_whence whence;
Junio C Hamano37d07f82007-12-13 03:09:1652 int nowarn;
Junio C Hamanod249b092009-08-10 04:59:3053 int use_color;
Matthieu Moy7a76c282014-03-20 12:12:4154 int no_gettext;
Matthieu Moy2556b992013-09-06 17:43:0755 int display_comment_prefix;
Junio C Hamanod249b092009-08-10 04:59:3056 int relative_paths;
57 int submodule_summary;
Junio C Hamano6cb3f6b2010-04-10 07:11:5358 int show_ignored_files;
Junio C Hamanod249b092009-08-10 04:59:3059 enum untracked_status_type show_untracked_files;
Jens Lehmann46a958b2010-06-25 14:56:4760 const char *ignore_submodule_arg;
Aleksi Aalto1d282322010-11-17 23:40:0561 char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN];
Jeff King4d2292e2012-05-07 19:35:0362 unsigned colopts;
Jeff King3207a3a2012-05-07 19:44:4463 int null_termination;
Jeff Kingd4a6bf12012-05-07 21:09:0464 int show_branch;
Matthieu Moy6a964f52013-09-12 10:50:0565 int hints;
Junio C Hamanod249b092009-08-10 04:59:3066
Jürgen Rühle2a3a3c22007-01-10 22:25:0367 /* These are computed during processing of the individual sections */
68 int commitable;
69 int workdir_dirty;
Kristian Høgsberg0f729f22007-09-18 00:06:4370 const char *index_file;
Kristian Høgsbergf26a0012007-09-18 00:06:4271 FILE *fp;
Johannes Schindelin367c9882007-11-11 17:35:4172 const char *prefix;
Junio C Hamano50b7e702009-08-05 06:49:3373 struct string_list change;
Junio C Hamano76378682009-08-10 07:36:3374 struct string_list untracked;
Junio C Hamano6cb3f6b2010-04-10 07:11:5375 struct string_list ignored;
Nguyễn Thái Ngọc Duy6a38ef22013-03-13 12:59:1676 uint32_t untracked_in_ms;
Jeff Kingc91f0d92006-09-08 08:05:3477};
78
Lucien Kong83c750a2012-06-05 20:21:2479struct wt_status_state {
80 int merge_in_progress;
81 int am_in_progress;
82 int am_empty_patch;
83 int rebase_in_progress;
84 int rebase_interactive_in_progress;
85 int cherry_pick_in_progress;
86 int bisect_in_progress;
Matthieu Moydb4ef442013-04-02 14:20:2187 int revert_in_progress;
Michael J Gruber970399e2015-03-06 15:04:0688 int detached_at;
Nguyễn Thái Ngọc Duy8b87cfd2013-03-16 02:12:3689 char *branch;
90 char *onto;
Nguyễn Thái Ngọc Duyb397ea42013-03-13 11:42:5291 char *detached_from;
92 unsigned char detached_sha1[20];
Matthieu Moy87e139c2013-04-02 14:20:2293 unsigned char revert_head_sha1[20];
Ralf Thielowbffd8092013-10-11 15:58:3794 unsigned char cherry_pick_head_sha1[20];
Lucien Kong83c750a2012-06-05 20:21:2495};
96
Jens Lehmann1a72cfd2013-12-05 19:44:1497void wt_status_truncate_message_at_cut_line(struct strbuf *);
Nguyễn Thái Ngọc Duyfcef9312014-02-17 12:15:3198void wt_status_add_cut_line(FILE *fp);
Jeff Kingc91f0d92006-09-08 08:05:3499void wt_status_prepare(struct wt_status *s);
100void wt_status_print(struct wt_status *s);
Junio C Hamano76378682009-08-10 07:36:33101void wt_status_collect(struct wt_status *s);
Nguyễn Thái Ngọc Duyb397ea42013-03-13 11:42:52102void wt_status_get_state(struct wt_status_state *state, int get_detached_from);
Jeff Kingc91f0d92006-09-08 08:05:34103
Jeff Kingd4a6bf12012-05-07 21:09:04104void wt_shortstatus_print(struct wt_status *s);
Jeff King3207a3a2012-05-07 19:44:44105void wt_porcelain_print(struct wt_status *s);
Michael J Gruber84dbe7b2009-12-05 15:04:37106
Jeff King8dd0ee82013-07-10 00:23:28107__attribute__((format (printf, 3, 4)))
108void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...);
109__attribute__((format (printf, 3, 4)))
110void status_printf(struct wt_status *s, const char *color, const char *fmt, ...);
Jonathan Niederbecbdae2011-02-26 05:09:41111
Jeff Kingc91f0d92006-09-08 08:05:34112#endif /* STATUS_H */