From: Junio C Hamano Date: Wed, 28 Feb 2018 21:37:52 +0000 (-0800) Subject: Merge branch 'nd/am-quit' X-Git-Tag: v2.17.0-rc0~59 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c22c624a9de3576d6e66f81c3a1edc6dfcfb08bb?hp=-c Merge branch 'nd/am-quit' "git am" has learned the "--quit" option, in addition to the existing "--abort" option; having the pair mirrors a few other commands like "rebase" and "cherry-pick". * nd/am-quit: am: support --quit --- c22c624a9de3576d6e66f81c3a1edc6dfcfb08bb diff --combined builtin/am.c index 6661edc162,793c1e2765..05a82f4aa5 --- a/builtin/am.c +++ b/builtin/am.c @@@ -1641,8 -1641,8 +1641,8 @@@ static void do_commit(const struct am_s setenv("GIT_COMMITTER_DATE", state->ignore_date ? "" : state->author_date, 1); - if (commit_tree(state->msg, state->msg_len, tree.hash, parents, commit.hash, - author, state->sign_commit)) + if (commit_tree(state->msg, state->msg_len, &tree, parents, &commit, + author, state->sign_commit)) die(_("failed to write commit object")); reflog_msg = getenv("GIT_REFLOG_ACTION"); @@@ -2149,7 -2149,8 +2149,8 @@@ enum resume_mode RESUME_APPLY, RESUME_RESOLVED, RESUME_SKIP, - RESUME_ABORT + RESUME_ABORT, + RESUME_QUIT }; static int git_am_config(const char *k, const char *v, void *cb) @@@ -2249,6 -2250,9 +2250,9 @@@ int cmd_am(int argc, const char **argv OPT_CMDMODE(0, "abort", &resume, N_("restore the original branch and abort the patching operation."), RESUME_ABORT), + OPT_CMDMODE(0, "quit", &resume, + N_("abort the patching operation but keep HEAD where it is."), + RESUME_QUIT), OPT_BOOL(0, "committer-date-is-author-date", &state.committer_date_is_author_date, N_("lie about committer date")), @@@ -2317,7 -2321,7 +2321,7 @@@ * stray directories. */ if (file_exists(state.dir) && !state.rebasing) { - if (resume == RESUME_ABORT) { + if (resume == RESUME_ABORT || resume == RESUME_QUIT) { am_destroy(&state); am_state_release(&state); return 0; @@@ -2359,6 -2363,10 +2363,10 @@@ case RESUME_ABORT: am_abort(&state); break; + case RESUME_QUIT: + am_rerere_clear(); + am_destroy(&state); + break; default: die("BUG: invalid resume value"); }