diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-02-11 16:43:27 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-12 14:07:59 -0800 |
commit | 66335298a47032267edd6d6e7a71cc337e46e995 (patch) | |
tree | 547baec4b4e0f79368fac37c21ed84e0effef503 /builtin/am.c | |
parent | 984913a210bb6d17fb3dd515975930661a00c3b5 (diff) | |
download | git-66335298a47032267edd6d6e7a71cc337e46e995.tar.gz |
rebase: add --show-current-patch
It is useful to see the full patch while resolving conflicts in a
rebase. The only way to do it now is
less .git/rebase-*/patch
which could turn out to be a lot longer to type if you are in a
linked worktree, or not at top-dir. On top of that, an ordinary user
should not need to peek into .git directory. The new option is
provided to examine the patch.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
-rw-r--r-- | builtin/am.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c index 07abfb8f83..37219fceb0 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2126,6 +2126,17 @@ static int show_patch(struct am_state *state) const char *patch_path; int len; + if (!is_null_oid(&state->orig_commit)) { + const char *av[4] = { "show", NULL, "--", NULL }; + char *new_oid_str; + int ret; + + av[1] = new_oid_str = xstrdup(oid_to_hex(&state->orig_commit)); + ret = run_command_v_opt(av, RUN_GIT_CMD); + free(new_oid_str); + return ret; + } + patch_path = am_path(state, msgnum(state)); len = strbuf_read_file(&sb, patch_path, 0); if (len < 0) |