From fbd7a23237094c3fb2e249bbcacbbf1e858e79c9 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sun, 11 Feb 2018 16:43:28 +0700 Subject: rebase: introduce and use pseudo-ref REBASE_HEAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new command `git rebase --show-current-patch` is useful for seeing the commit related to the current rebase state. Some however may find the "git show" command behind it too limiting. You may want to increase context lines, do a diff that ignores whitespaces... For these advanced use cases, the user can execute any command they want with the new pseudo ref REBASE_HEAD. This also helps show where the stopped commit is from, which is hard to see from the previous patch which implements --show-current-patch. Helped-by: Tim Landscheidt Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- git-rebase--merge.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git-rebase--merge.sh') diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh index 0a96dfae37..957688f236 100644 --- a/git-rebase--merge.sh +++ b/git-rebase--merge.sh @@ -57,6 +57,7 @@ call_merge () { echo "$msgnum" >"$state_dir/msgnum" cmt="$(cat "$state_dir/cmt.$msgnum")" echo "$cmt" > "$state_dir/current" + git update-ref REBASE_HEAD "$cmt" hd=$(git rev-parse --verify HEAD) cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD) eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"' @@ -138,13 +139,14 @@ skip) return ;; show-current-patch) - exec git show "$(cat "$state_dir/current")" -- + exec git show REBASE_HEAD -- ;; esac mkdir -p "$state_dir" echo "$onto_name" > "$state_dir/onto_name" write_basic_state +rm -f "$(git rev-parse --git-path REBASE_HEAD)" msgnum=0 for cmt in $(git rev-list --reverse --no-merges "$revisions") -- cgit v1.2.3