git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood@talktalk.net>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] rebase: add --show-patch
Date: Fri, 26 Jan 2018 11:12:22 +0000	[thread overview]
Message-ID: <4d7eb4c8-8d48-7c8d-259a-ba6b2f64def0@talktalk.net> (raw)
In-Reply-To: <20180126095520.919-3-pclouds@gmail.com>

On 26/01/18 09:55, Nguyễn Thái Ngọc Duy wrote:
> 
> 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 [1] 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.
> 
> [1] A conflict caused by git-rebase--am.sh does show the path to this
>     patch file so you could copy/paste. But then after some time and
>     lots of commands to resolve the conflict, that path is likely
>     scrolled out of your terminal.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Documentation/git-rebase.txt           |  5 +++-
>  contrib/completion/git-completion.bash |  4 +--
>  git-rebase--am.sh                      |  3 +++
>  git-rebase--interactive.sh             |  4 +++
>  git-rebase--merge.sh                   |  4 +++
>  git-rebase.sh                          |  7 +++++-
>  t/t3400-rebase.sh                      | 34 ++++++++++++++++++++++++++
>  t/t3404-rebase-interactive.sh          |  6 +++++
>  8 files changed, 63 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 8a861c1e0d..4fd571d393 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -12,7 +12,7 @@ SYNOPSIS
>  	[<upstream> [<branch>]]
>  'git rebase' [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
>  	--root [<branch>]
> -'git rebase' --continue | --skip | --abort | --quit | --edit-todo
> +'git rebase' --continue | --skip | --abort | --quit | --edit-todo | --show-patch
>  
>  DESCRIPTION
>  -----------
> @@ -250,6 +250,9 @@ leave out at most one of A and B, in which case it defaults to HEAD.
>  --edit-todo::
>  	Edit the todo list during an interactive rebase.
>  
> +--show-patch::
> +	Show the current patch in an interactive rebase.
> +
>  -m::
>  --merge::
>  	Use merging strategies to rebase.  When the recursive (default) merge
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 1e9105f6d5..b70da4990f 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1992,11 +1992,11 @@ _git_rebase ()
>  {
>  	__git_find_repo_path
>  	if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
> -		__gitcomp "--continue --skip --abort --quit --edit-todo"
> +		__gitcomp "--continue --skip --abort --quit --edit-todo --show-patch"
>  		return
>  	elif [ -d "$__git_repo_path"/rebase-apply ] || \
>  	     [ -d "$__git_repo_path"/rebase-merge ]; then
> -		__gitcomp "--continue --skip --abort --quit"
> +		__gitcomp "--continue --skip --abort --quit --show-patch"
>  		return
>  	fi
>  	__git_complete_strategy && return
> diff --git a/git-rebase--am.sh b/git-rebase--am.sh
> index 14c50782e0..564a4a5830 100644
> --- a/git-rebase--am.sh
> +++ b/git-rebase--am.sh
> @@ -27,6 +27,9 @@ skip)
>  	move_to_original_branch
>  	return
>  	;;
> +show-patch)
> +	exec git am --show-patch
> +	;;
>  esac
>  
>  if test -z "$rebase_root"
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index d47bd29593..01cc002efd 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -840,6 +840,10 @@ To continue rebase after editing, run:
>  
>  	exit
>  	;;
> +show-patch)
> +	cmt="$(cat "$state_dir/stopped-sha")"
> +	exec git format-patch --subject-prefix= --stdout "${cmt}^!"
> +	;;
>  esac
>  
>  comment_for_reflog start
> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
> index 06a4723d4d..5c513a9736 100644
> --- a/git-rebase--merge.sh
> +++ b/git-rebase--merge.sh
> @@ -137,6 +137,10 @@ skip)
>  	finish_rb_merge
>  	return
>  	;;
> +show-patch)
> +	cmt="$(cat "$state_dir/current")"
> +	exec git format-patch --subject-prefix= --stdout "${cmt}^!"
> +	;;
>  esac

Here and in the git-rebase--interactive you have access to the SHA of
the failed pick so you could run git log --patch and git colored output
and it would use the pager in the same way as 'git am --show-patch' does

Best Wishes

Phillip

  reply	other threads:[~2018-01-26 11:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26  9:55 [PATCH 0/2] Add "git rebase --show-patch" Nguyễn Thái Ngọc Duy
2018-01-26  9:55 ` [PATCH 1/2] am: add --show-patch Nguyễn Thái Ngọc Duy
2018-01-26  9:55 ` [PATCH 2/2] rebase: " Nguyễn Thái Ngọc Duy
2018-01-26 11:12   ` Phillip Wood [this message]
2018-01-26 11:22     ` Duy Nguyen
2018-01-30 11:15       ` Phillip Wood
2018-01-26 19:11   ` Eric Sunshine
2018-01-27  1:42     ` Duy Nguyen
2018-01-26 18:47 ` [PATCH 0/2] Add "git rebase --show-patch" Tim Landscheidt
2018-01-27  1:45   ` Duy Nguyen
2018-01-27 11:26 ` Ævar Arnfjörð Bjarmason
2018-01-29 15:09 ` Johannes Schindelin
2018-01-30  9:10   ` Duy Nguyen
2018-01-30 12:32     ` Johannes Schindelin
2018-01-30 20:19       ` Junio C Hamano
2018-02-01  2:06         ` Tim Landscheidt
2018-01-31  9:30 ` [PATCH v2 0/3] " Nguyễn Thái Ngọc Duy
2018-01-31  9:30   ` [PATCH v2 1/3] am: add --show-current-patch Nguyễn Thái Ngọc Duy
2018-01-31  9:40     ` Eric Sunshine
2018-01-31 22:59       ` Junio C Hamano
2018-02-02  9:25         ` Duy Nguyen
2018-02-02  9:46           ` Eric Sunshine
2018-02-02  9:53             ` Duy Nguyen
2018-02-02 18:56           ` Junio C Hamano
2018-01-31  9:30   ` [PATCH] gitignore.txt: elaborate shell glob syntax Nguyễn Thái Ngọc Duy
2018-01-31 23:22     ` Junio C Hamano
2018-02-01  9:59       ` Duy Nguyen
2018-01-31  9:30   ` [PATCH v2 2/3] rebase: add --show-current-patch Nguyễn Thái Ngọc Duy
2018-01-31  9:30   ` [PATCH v2 3/3] rebase: introduce and use pseudo-ref ORIG_COMMIT Nguyễn Thái Ngọc Duy
2018-01-31 23:18     ` Junio C Hamano
2018-02-01 10:02       ` Duy Nguyen
2018-02-02 19:00         ` Junio C Hamano
2018-02-01 11:05     ` Phillip Wood
2018-02-11  9:43   ` [PATCH v3 0/3] Add "git rebase --show-current-patch" Nguyễn Thái Ngọc Duy
2018-02-11  9:43     ` [PATCH v3 1/3] am: add --show-current-patch Nguyễn Thái Ngọc Duy
2018-02-11  9:43     ` [PATCH v3 2/3] rebase: " Nguyễn Thái Ngọc Duy
2018-02-11  9:43     ` [PATCH v3 3/3] rebase: introduce and use pseudo-ref REBASE_HEAD Nguyễn Thái Ngọc Duy
2018-02-22  0:21     ` [PATCH v3 0/3] Add "git rebase --show-current-patch" Junio C Hamano
2018-02-22  0:54       ` Tim Landscheidt
2018-02-23 10:20         ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d7eb4c8-8d48-7c8d-259a-ba6b2f64def0@talktalk.net \
    --to=phillip.wood@talktalk.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).