Merge branch 'nd/rebase-show-current-patch'
authorJunio C Hamano <gitster@pobox.com>
Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)
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

1  2 
Documentation/git-am.txt
Documentation/git-rebase.txt
builtin/am.c
contrib/completion/git-completion.bash
git-rebase--am.sh
git-rebase--interactive.sh
git-rebase--merge.sh
git-rebase.sh
sequencer.c
t/t3404-rebase-interactive.sh
t/t4150-am.sh
index 460662e4b92b56c25989c9d1770165ea9a6a16a2,0f426ae8749c31efc98af8d155a60358705d4c3a..6f6c34b0f4bc9ba18ec890dff1a6fe10af2fd68f
@@@ -16,7 -16,7 +16,7 @@@ SYNOPSI
         [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
         [--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>]
         [(<mbox> | <Maildir>)...]
- '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
  ----------
  
Simple merge
diff --cc builtin/am.c
index 05a82f4aa5be6ba82d409f002dce7786734780a1,21aedec41f0aa742af2b611fe059a59ff1c21621..1151b5c73aec81dbfca36a799cd4049429c75973
@@@ -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")),
        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");
        }
index 4c86ab66e23ee02e15f15173bc7e613c20347f36,8777805c9fd64f5513462540b20464bfdaf9ca24..91536d831c8954b67efe738ace3fad7f8f2ee2d7
@@@ -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
Simple merge
Simple merge
Simple merge
diff --cc git-rebase.sh
Simple merge
diff --cc sequencer.c
Simple merge
Simple merge
diff --cc t/t4150-am.sh
Simple merge