summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c
index abc6d5cdfd..aedca2d52b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -679,9 +679,6 @@ static int do_recursive_merge(struct repository *r,
static struct object_id *get_cache_tree_oid(struct index_state *istate)
{
- if (!istate->cache_tree)
- istate->cache_tree = cache_tree();
-
if (!cache_tree_fully_valid(istate->cache_tree))
if (cache_tree_update(istate, 0)) {
error(_("unable to update cache tree"));
@@ -943,6 +940,7 @@ N_("you have staged changes in your working tree\n"
#define CLEANUP_MSG (1<<3)
#define VERIFY_MSG (1<<4)
#define CREATE_ROOT_COMMIT (1<<5)
+#define VERBATIM_MSG (1<<6)
static int run_command_silent_on_success(struct child_process *cmd)
{
@@ -979,6 +977,9 @@ static int run_git_commit(const char *defmsg,
{
struct child_process cmd = CHILD_PROCESS_INIT;
+ if ((flags & CLEANUP_MSG) && (flags & VERBATIM_MSG))
+ BUG("CLEANUP_MSG and VERBATIM_MSG are mutually exclusive");
+
cmd.git_cmd = 1;
if (is_rebase_i(opts) && read_env_script(&cmd.env_array)) {
@@ -1012,6 +1013,8 @@ static int run_git_commit(const char *defmsg,
strvec_pushl(&cmd.args, "-C", "HEAD", NULL);
if ((flags & CLEANUP_MSG))
strvec_push(&cmd.args, "--cleanup=strip");
+ if ((flags & VERBATIM_MSG))
+ strvec_push(&cmd.args, "--cleanup=verbatim");
if ((flags & EDIT_MSG))
strvec_push(&cmd.args, "-e");
else if (!(flags & CLEANUP_MSG) &&
@@ -1380,6 +1383,9 @@ static int try_to_commit(struct repository *r,
enum commit_msg_cleanup_mode cleanup;
int res = 0;
+ if ((flags & CLEANUP_MSG) && (flags & VERBATIM_MSG))
+ BUG("CLEANUP_MSG and VERBATIM_MSG are mutually exclusive");
+
if (parse_head(r, &current_head))
return -1;
@@ -1454,6 +1460,8 @@ static int try_to_commit(struct repository *r,
if (flags & CLEANUP_MSG)
cleanup = COMMIT_MSG_CLEANUP_ALL;
+ else if (flags & VERBATIM_MSG)
+ cleanup = COMMIT_MSG_CLEANUP_NONE;
else if ((opts->signoff || opts->record_origin) &&
!opts->explicit_cleanup)
cleanup = COMMIT_MSG_CLEANUP_SPACE;
@@ -2190,7 +2198,7 @@ static int do_pick_commit(struct repository *r,
if (!final_fixup)
msg_file = rebase_path_squash_msg();
else if (file_exists(rebase_path_fixup_msg())) {
- flags |= CLEANUP_MSG;
+ flags |= VERBATIM_MSG;
msg_file = rebase_path_fixup_msg();
} else {
const char *dest = git_path_squash_msg(r);
@@ -5362,7 +5370,7 @@ void todo_list_add_exec_commands(struct todo_list *todo_list,
int i, insert, nr = 0, alloc = 0;
struct todo_item *items = NULL, *base_items = NULL;
- base_items = xcalloc(commands->nr, sizeof(struct todo_item));
+ CALLOC_ARRAY(base_items, commands->nr);
for (i = 0; i < commands->nr; i++) {
size_t command_len = strlen(commands->items[i].string);