2006-09-08 08:05:34 +00:00
|
|
|
#ifndef STATUS_H
|
|
|
|
#define STATUS_H
|
|
|
|
|
2007-09-18 00:06:42 +00:00
|
|
|
#include <stdio.h>
|
2009-08-05 06:49:33 +00:00
|
|
|
#include "string-list.h"
|
2009-08-10 06:08:40 +00:00
|
|
|
#include "color.h"
|
2015-08-20 14:06:27 +00:00
|
|
|
#include "pathspec.h"
|
2007-09-18 00:06:42 +00:00
|
|
|
|
2016-04-22 13:01:31 +00:00
|
|
|
struct worktree;
|
|
|
|
|
2006-09-08 08:05:34 +00:00
|
|
|
enum color_wt_status {
|
2009-08-10 06:08:40 +00:00
|
|
|
WT_STATUS_HEADER = 0,
|
2006-09-08 08:05:34 +00:00
|
|
|
WT_STATUS_UPDATED,
|
|
|
|
WT_STATUS_CHANGED,
|
|
|
|
WT_STATUS_UNTRACKED,
|
2008-05-22 12:50:02 +00:00
|
|
|
WT_STATUS_NOBRANCH,
|
2009-08-05 07:04:51 +00:00
|
|
|
WT_STATUS_UNMERGED,
|
2010-05-25 13:45:51 +00:00
|
|
|
WT_STATUS_LOCAL_BRANCH,
|
2010-11-17 23:40:05 +00:00
|
|
|
WT_STATUS_REMOTE_BRANCH,
|
|
|
|
WT_STATUS_ONBRANCH,
|
|
|
|
WT_STATUS_MAXSLOT
|
2006-09-08 08:05:34 +00:00
|
|
|
};
|
|
|
|
|
2008-06-05 08:31:19 +00:00
|
|
|
enum untracked_status_type {
|
2008-06-05 12:22:56 +00:00
|
|
|
SHOW_NO_UNTRACKED_FILES,
|
|
|
|
SHOW_NORMAL_UNTRACKED_FILES,
|
2008-06-05 08:31:19 +00:00
|
|
|
SHOW_ALL_UNTRACKED_FILES
|
|
|
|
};
|
|
|
|
|
2011-02-20 04:12:29 +00:00
|
|
|
/* from where does this commit originate */
|
|
|
|
enum commit_whence {
|
|
|
|
FROM_COMMIT, /* normal */
|
|
|
|
FROM_MERGE, /* commit came from merge */
|
|
|
|
FROM_CHERRY_PICK /* commit came from cherry-pick */
|
|
|
|
};
|
|
|
|
|
2009-08-05 06:49:33 +00:00
|
|
|
struct wt_status_change_data {
|
|
|
|
int worktree_status;
|
|
|
|
int index_status;
|
|
|
|
int stagemask;
|
2016-08-11 14:45:57 +00:00
|
|
|
int score;
|
|
|
|
int mode_head, mode_index, mode_worktree;
|
|
|
|
struct object_id oid_head, oid_index;
|
2009-08-05 06:49:33 +00:00
|
|
|
char *head_path;
|
2010-03-08 12:53:19 +00:00
|
|
|
unsigned dirty_submodule : 2;
|
|
|
|
unsigned new_submodule_commits : 1;
|
2009-08-05 06:49:33 +00:00
|
|
|
};
|
|
|
|
|
2016-08-05 22:00:27 +00:00
|
|
|
enum wt_status_format {
|
|
|
|
STATUS_FORMAT_NONE = 0,
|
|
|
|
STATUS_FORMAT_LONG,
|
|
|
|
STATUS_FORMAT_SHORT,
|
|
|
|
STATUS_FORMAT_PORCELAIN,
|
2016-08-11 14:45:57 +00:00
|
|
|
STATUS_FORMAT_PORCELAIN_V2,
|
2016-08-05 22:00:27 +00:00
|
|
|
|
|
|
|
STATUS_FORMAT_UNSPECIFIED
|
|
|
|
};
|
|
|
|
|
2006-09-08 08:05:34 +00:00
|
|
|
struct wt_status {
|
|
|
|
int is_initial;
|
|
|
|
char *branch;
|
|
|
|
const char *reference;
|
2013-07-14 08:35:39 +00:00
|
|
|
struct pathspec pathspec;
|
2006-09-08 08:05:34 +00:00
|
|
|
int verbose;
|
|
|
|
int amend;
|
2011-02-20 04:12:29 +00:00
|
|
|
enum commit_whence whence;
|
2007-12-13 03:09:16 +00:00
|
|
|
int nowarn;
|
2009-08-10 04:59:30 +00:00
|
|
|
int use_color;
|
2014-03-20 12:12:41 +00:00
|
|
|
int no_gettext;
|
2013-09-06 17:43:07 +00:00
|
|
|
int display_comment_prefix;
|
2009-08-10 04:59:30 +00:00
|
|
|
int relative_paths;
|
|
|
|
int submodule_summary;
|
2010-04-10 07:11:53 +00:00
|
|
|
int show_ignored_files;
|
2009-08-10 04:59:30 +00:00
|
|
|
enum untracked_status_type show_untracked_files;
|
2010-06-25 14:56:47 +00:00
|
|
|
const char *ignore_submodule_arg;
|
2010-11-17 23:40:05 +00:00
|
|
|
char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN];
|
2012-05-07 19:35:03 +00:00
|
|
|
unsigned colopts;
|
2012-05-07 19:44:44 +00:00
|
|
|
int null_termination;
|
2012-05-07 21:09:04 +00:00
|
|
|
int show_branch;
|
2013-09-12 10:50:05 +00:00
|
|
|
int hints;
|
2009-08-10 04:59:30 +00:00
|
|
|
|
2016-08-05 22:00:27 +00:00
|
|
|
enum wt_status_format status_format;
|
|
|
|
|
2007-01-10 22:25:03 +00:00
|
|
|
/* These are computed during processing of the individual sections */
|
|
|
|
int commitable;
|
|
|
|
int workdir_dirty;
|
2007-09-18 00:06:43 +00:00
|
|
|
const char *index_file;
|
2007-09-18 00:06:42 +00:00
|
|
|
FILE *fp;
|
2007-11-11 17:35:41 +00:00
|
|
|
const char *prefix;
|
2009-08-05 06:49:33 +00:00
|
|
|
struct string_list change;
|
2009-08-10 07:36:33 +00:00
|
|
|
struct string_list untracked;
|
2010-04-10 07:11:53 +00:00
|
|
|
struct string_list ignored;
|
2013-03-13 12:59:16 +00:00
|
|
|
uint32_t untracked_in_ms;
|
2006-09-08 08:05:34 +00:00
|
|
|
};
|
|
|
|
|
2012-06-05 20:21:24 +00:00
|
|
|
struct wt_status_state {
|
|
|
|
int merge_in_progress;
|
|
|
|
int am_in_progress;
|
|
|
|
int am_empty_patch;
|
|
|
|
int rebase_in_progress;
|
|
|
|
int rebase_interactive_in_progress;
|
|
|
|
int cherry_pick_in_progress;
|
|
|
|
int bisect_in_progress;
|
2013-04-02 14:20:21 +00:00
|
|
|
int revert_in_progress;
|
2015-03-06 15:04:06 +00:00
|
|
|
int detached_at;
|
2013-03-16 02:12:36 +00:00
|
|
|
char *branch;
|
|
|
|
char *onto;
|
2013-03-13 11:42:52 +00:00
|
|
|
char *detached_from;
|
|
|
|
unsigned char detached_sha1[20];
|
2013-04-02 14:20:22 +00:00
|
|
|
unsigned char revert_head_sha1[20];
|
2013-10-11 15:58:37 +00:00
|
|
|
unsigned char cherry_pick_head_sha1[20];
|
2012-06-05 20:21:24 +00:00
|
|
|
};
|
|
|
|
|
2013-12-05 19:44:14 +00:00
|
|
|
void wt_status_truncate_message_at_cut_line(struct strbuf *);
|
2014-02-17 12:15:31 +00:00
|
|
|
void wt_status_add_cut_line(FILE *fp);
|
2006-09-08 08:05:34 +00:00
|
|
|
void wt_status_prepare(struct wt_status *s);
|
2016-08-05 22:00:27 +00:00
|
|
|
void wt_status_print(struct wt_status *s);
|
2009-08-10 07:36:33 +00:00
|
|
|
void wt_status_collect(struct wt_status *s);
|
2013-03-13 11:42:52 +00:00
|
|
|
void wt_status_get_state(struct wt_status_state *state, int get_detached_from);
|
2016-04-22 13:01:31 +00:00
|
|
|
int wt_status_check_rebase(const struct worktree *wt,
|
|
|
|
struct wt_status_state *state);
|
2016-04-22 13:01:34 +00:00
|
|
|
int wt_status_check_bisect(const struct worktree *wt,
|
|
|
|
struct wt_status_state *state);
|
2006-09-08 08:05:34 +00:00
|
|
|
|
2013-07-10 00:23:28 +00:00
|
|
|
__attribute__((format (printf, 3, 4)))
|
|
|
|
void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...);
|
|
|
|
__attribute__((format (printf, 3, 4)))
|
|
|
|
void status_printf(struct wt_status *s, const char *color, const char *fmt, ...);
|
2011-02-26 05:09:41 +00:00
|
|
|
|
2006-09-08 08:05:34 +00:00
|
|
|
#endif /* STATUS_H */
|