Skip to content

Commit f69a8be

Browse files
committed
sequencer: remember special error conditions
A cherry-pick can fail in surprising ways. For example, if it would overwrite an untracked file, it does not even start to do anything, let alone record that it is cherry-picking. To discern such cases from regular error conditions where the user simply has to resolve a merge conflict and then can call `git commit` to finalize the cherry-pick (reusing the original commit message), such a "really fatal" error is indicated by using an exit code != 1. This means that we have to remember such an exit code by OR'ing later error conditions. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 2748862 commit f69a8be

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

sequencer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
807807
const char *base_label, *next_label;
808808
struct commit_message msg = { NULL, NULL, NULL, NULL };
809809
struct strbuf msgbuf = STRBUF_INIT;
810-
int res, unborn = 0, amend = 0, allow;
810+
int res = 0, unborn = 0, amend = 0, allow, fast_forward = 0;
811811

812812
if (opts->no_commit) {
813813
/*
@@ -945,14 +945,14 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
945945
write_author_script(msg.message);
946946

947947
if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {
948-
res = do_recursive_merge(base, next, base_label, next_label,
948+
res |= do_recursive_merge(base, next, base_label, next_label,
949949
head, &msgbuf, opts);
950950
res |= write_message(&msgbuf, git_path_merge_msg());
951951
} else {
952952
struct commit_list *common = NULL;
953953
struct commit_list *remotes = NULL;
954954

955-
res = write_message(&msgbuf, git_path_merge_msg());
955+
res |= write_message(&msgbuf, git_path_merge_msg());
956956

957957
commit_list_insert(base, &common);
958958
commit_list_insert(next, &remotes);
@@ -987,11 +987,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
987987

988988
allow = allow_empty(opts, commit);
989989
if (allow < 0) {
990-
res = allow;
990+
res |= allow;
991991
goto leave;
992992
}
993993
if (!opts->no_commit)
994-
res = sequencer_commit(msg_file, opts, allow, edit, amend);
994+
res |= sequencer_commit(msg_file, opts, allow, edit, amend);
995995

996996
if (!res && final_fixup) {
997997
unlink(fixup_msg());

0 commit comments

Comments
 (0)