From: Junio C Hamano Date: Tue, 27 Feb 2018 19:15:10 +0000 (-0800) Subject: Merge branch 'nd/rebase-show-current-patch' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5a4e23a77c555999e3914543b976ce9c436fe352?hp=--cc Merge branch 'nd/rebase-show-current-patch' into next The new "--show-current-patch" option gives an end-user facing way to get the diff being applied when "git rebase" (and "git am") stops with a conflict. * nd/rebase-show-current-patch: rebase: introduce and use pseudo-ref REBASE_HEAD rebase: add --show-current-patch am: add --show-current-patch --- 5a4e23a77c555999e3914543b976ce9c436fe352 diff --cc Documentation/git-am.txt index 460662e4b9,0f426ae874..6f6c34b0f4 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@@ -16,7 -16,7 +16,7 @@@ SYNOPSI [--exclude=] [--include=] [--reject] [-q | --quiet] [--[no-]scissors] [-S[]] [--patch-format=] [( | )...] - 'git am' (--continue | --skip | --abort | --quit) -'git am' (--continue | --skip | --abort | --show-current-patch) ++'git am' (--continue | --skip | --abort | --quit | --show-current-patch) DESCRIPTION ----------- @@@ -167,10 -167,10 +167,14 @@@ default. You can use `--no-utf8` to o --abort:: Restore the original branch and abort the patching operation. +--quit:: + Abort the patching operation but keep HEAD and the index + untouched. + + --show-current-patch:: + Show the patch being applied when "git am" is stopped because + of conflicts. + DISCUSSION ---------- diff --cc builtin/am.c index 05a82f4aa5,21aedec41f..1151b5c73a --- a/builtin/am.c +++ b/builtin/am.c @@@ -2150,7 -2181,7 +2181,8 @@@ enum resume_mode RESUME_RESOLVED, RESUME_SKIP, RESUME_ABORT, - RESUME_QUIT ++ RESUME_QUIT, + RESUME_SHOW_PATCH }; static int git_am_config(const char *k, const char *v, void *cb) @@@ -2250,9 -2282,9 +2283,12 @@@ 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_CMDMODE(0, "show-current-patch", &resume, + N_("show the patch being applied."), + RESUME_SHOW_PATCH), OPT_BOOL(0, "committer-date-is-author-date", &state.committer_date_is_author_date, N_("lie about committer date")), @@@ -2363,10 -2395,9 +2399,13 @@@ case RESUME_ABORT: am_abort(&state); break; + case RESUME_QUIT: + am_rerere_clear(); + am_destroy(&state); + break; + case RESUME_SHOW_PATCH: + ret = show_patch(&state); + break; default: die("BUG: invalid resume value"); } diff --cc contrib/completion/git-completion.bash index 4c86ab66e2,8777805c9f..91536d831c --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -1077,7 -1077,7 +1077,7 @@@ _git_am ( { __git_find_repo_path if [ -d "$__git_repo_path"/rebase-apply ]; then - __gitcomp "--skip --continue --resolved --abort --quit" - __gitcomp "--skip --continue --resolved --abort --show-current-patch" ++ __gitcomp "--skip --continue --resolved --abort --quit --show-current-patch" return fi case "$cur" in