sequencer: make three functions and an enum from sequencer.c public
This makes rebase_path_todo(), get_missing_commit_check_level(), write_message() and the enum check_level accessible outside sequencer.c, renames check_level to missing_commit_check_level, and prefixes its value names by MISSING_COMMIT_ to avoid namespace pollution. This function and this enum will eventually be moved to rebase-interactive.c and become static again, so no special attention was given to the naming. This will be needed for the rewrite of append_todo_help() from shell to C, as it will be in a new library source file, rebase-interactive.c. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b7bd9486b0
commit
44b776c3e9
26
sequencer.c
26
sequencer.c
@ -52,7 +52,7 @@ static GIT_PATH_FUNC(rebase_path, "rebase-merge")
|
|||||||
* the lines are processed, they are removed from the front of this
|
* the lines are processed, they are removed from the front of this
|
||||||
* file and written to the tail of 'done'.
|
* file and written to the tail of 'done'.
|
||||||
*/
|
*/
|
||||||
static GIT_PATH_FUNC(rebase_path_todo, "rebase-merge/git-rebase-todo")
|
GIT_PATH_FUNC(rebase_path_todo, "rebase-merge/git-rebase-todo")
|
||||||
/*
|
/*
|
||||||
* The rebase command lines that have already been processed. A line
|
* The rebase command lines that have already been processed. A line
|
||||||
* is moved here when it is first handled, before any associated user
|
* is moved here when it is first handled, before any associated user
|
||||||
@ -373,8 +373,8 @@ static void print_advice(int show_hint, struct replay_opts *opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_message(const void *buf, size_t len, const char *filename,
|
int write_message(const void *buf, size_t len, const char *filename,
|
||||||
int append_eol)
|
int append_eol)
|
||||||
{
|
{
|
||||||
struct lock_file msg_file = LOCK_INIT;
|
struct lock_file msg_file = LOCK_INIT;
|
||||||
|
|
||||||
@ -4245,24 +4245,20 @@ int transform_todos(unsigned flags)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum check_level {
|
enum missing_commit_check_level get_missing_commit_check_level(void)
|
||||||
CHECK_IGNORE = 0, CHECK_WARN, CHECK_ERROR
|
|
||||||
};
|
|
||||||
|
|
||||||
static enum check_level get_missing_commit_check_level(void)
|
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
if (git_config_get_value("rebase.missingcommitscheck", &value) ||
|
if (git_config_get_value("rebase.missingcommitscheck", &value) ||
|
||||||
!strcasecmp("ignore", value))
|
!strcasecmp("ignore", value))
|
||||||
return CHECK_IGNORE;
|
return MISSING_COMMIT_CHECK_IGNORE;
|
||||||
if (!strcasecmp("warn", value))
|
if (!strcasecmp("warn", value))
|
||||||
return CHECK_WARN;
|
return MISSING_COMMIT_CHECK_WARN;
|
||||||
if (!strcasecmp("error", value))
|
if (!strcasecmp("error", value))
|
||||||
return CHECK_ERROR;
|
return MISSING_COMMIT_CHECK_ERROR;
|
||||||
warning(_("unrecognized setting %s for option "
|
warning(_("unrecognized setting %s for option "
|
||||||
"rebase.missingCommitsCheck. Ignoring."), value);
|
"rebase.missingCommitsCheck. Ignoring."), value);
|
||||||
return CHECK_IGNORE;
|
return MISSING_COMMIT_CHECK_IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
define_commit_slab(commit_seen, unsigned char);
|
define_commit_slab(commit_seen, unsigned char);
|
||||||
@ -4274,7 +4270,7 @@ define_commit_slab(commit_seen, unsigned char);
|
|||||||
*/
|
*/
|
||||||
int check_todo_list(void)
|
int check_todo_list(void)
|
||||||
{
|
{
|
||||||
enum check_level check_level = get_missing_commit_check_level();
|
enum missing_commit_check_level check_level = get_missing_commit_check_level();
|
||||||
struct strbuf todo_file = STRBUF_INIT;
|
struct strbuf todo_file = STRBUF_INIT;
|
||||||
struct todo_list todo_list = TODO_LIST_INIT;
|
struct todo_list todo_list = TODO_LIST_INIT;
|
||||||
struct strbuf missing = STRBUF_INIT;
|
struct strbuf missing = STRBUF_INIT;
|
||||||
@ -4291,7 +4287,7 @@ int check_todo_list(void)
|
|||||||
advise_to_edit_todo = res =
|
advise_to_edit_todo = res =
|
||||||
parse_insn_buffer(todo_list.buf.buf, &todo_list);
|
parse_insn_buffer(todo_list.buf.buf, &todo_list);
|
||||||
|
|
||||||
if (res || check_level == CHECK_IGNORE)
|
if (res || check_level == MISSING_COMMIT_CHECK_IGNORE)
|
||||||
goto leave_check;
|
goto leave_check;
|
||||||
|
|
||||||
/* Mark the commits in git-rebase-todo as seen */
|
/* Mark the commits in git-rebase-todo as seen */
|
||||||
@ -4326,7 +4322,7 @@ int check_todo_list(void)
|
|||||||
if (!missing.len)
|
if (!missing.len)
|
||||||
goto leave_check;
|
goto leave_check;
|
||||||
|
|
||||||
if (check_level == CHECK_ERROR)
|
if (check_level == MISSING_COMMIT_CHECK_ERROR)
|
||||||
advise_to_edit_todo = res = 1;
|
advise_to_edit_todo = res = 1;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
11
sequencer.h
11
sequencer.h
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
const char *git_path_commit_editmsg(void);
|
const char *git_path_commit_editmsg(void);
|
||||||
const char *git_path_seq_dir(void);
|
const char *git_path_seq_dir(void);
|
||||||
|
const char *rebase_path_todo(void);
|
||||||
|
|
||||||
#define APPEND_SIGNOFF_DEDUP (1u << 0)
|
#define APPEND_SIGNOFF_DEDUP (1u << 0)
|
||||||
|
|
||||||
@ -57,6 +58,15 @@ struct replay_opts {
|
|||||||
};
|
};
|
||||||
#define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
|
#define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
|
||||||
|
|
||||||
|
enum missing_commit_check_level {
|
||||||
|
MISSING_COMMIT_CHECK_IGNORE = 0,
|
||||||
|
MISSING_COMMIT_CHECK_WARN,
|
||||||
|
MISSING_COMMIT_CHECK_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
|
int write_message(const void *buf, size_t len, const char *filename,
|
||||||
|
int append_eol);
|
||||||
|
|
||||||
/* Call this to setup defaults before parsing command line options */
|
/* Call this to setup defaults before parsing command line options */
|
||||||
void sequencer_init_config(struct replay_opts *opts);
|
void sequencer_init_config(struct replay_opts *opts);
|
||||||
int sequencer_pick_revisions(struct replay_opts *opts);
|
int sequencer_pick_revisions(struct replay_opts *opts);
|
||||||
@ -79,6 +89,7 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,
|
|||||||
|
|
||||||
int sequencer_add_exec_commands(const char *command);
|
int sequencer_add_exec_commands(const char *command);
|
||||||
int transform_todos(unsigned flags);
|
int transform_todos(unsigned flags);
|
||||||
|
enum missing_commit_check_level get_missing_commit_check_level(void);
|
||||||
int check_todo_list(void);
|
int check_todo_list(void);
|
||||||
int skip_unnecessary_picks(void);
|
int skip_unnecessary_picks(void);
|
||||||
int rearrange_squash(void);
|
int rearrange_squash(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user