Subject: [PATCH 2/2] contrib/git-jump: add mode commit

From: Beat Bolli <[email-masked]>
Date: Sat, 21 Dec 2019 12:38:46 +0100

After committing, I often want to return to the place of the latest
change to continue my work. Add the new mode "commit" which does exactly
this.

Optional arguments are given to the "git show" call. So it's possible to
jump to changes of other commits than HEAD.

Signed-off-by: Beat Bolli <[email-masked]>
---
 contrib/git-jump/git-jump | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
index 776fa90f7f..e7192073c6 100644
--- a/contrib/git-jump/git-jump
+++ b/contrib/git-jump/git-jump
@@ -9,6 +9,9 @@ The <mode> parameter is one of:
 
 diff: elements are diff hunks. Arguments are given to diff.
 
+commit: element are the hunks of a commit (default HEAD). Arguments are
+        given to git show.
+
 merge: elements are merge conflicts. Arguments are ignored.
 
 grep: elements are grep hits. Arguments are given to git grep or, if
@@ -27,6 +30,10 @@ mode_diff() {
 	git diff --no-prefix --relative "$@" | diff_to_quickfix
 }
 
+mode_commit() {
+	git show --no-prefix --relative "$@" | diff_to_quickfix
+}
+
 diff_to_quickfix() {
 	perl -ne '
 	if (m{^\+\+\+ (.*)}) { $file = $1; next }
-- 
2.21.0.1020.gf2820cf01a