Git development
 help / color / mirror / Atom feed
From: Geoffrey Thomas <geofft@ldpreload.com>
To: git@vger.kernel.org
Cc: Geoffrey Thomas <geofft@ldpreload.com>
Subject: [PATCH 1/1] git jump: support show
Date: Wed, 14 Aug 2024 16:07:09 -0400	[thread overview]
Message-ID: <20240814200709.53450-1-geofft@ldpreload.com> (raw)

This makes it easy to go to the changes in the latest commit, or a
previous named commit, to fix a bug and commit a fixup, to respond to
code review feedback, etc.

Signed-off-by: Geoffrey Thomas <geofft@ldpreload.com>
---
 contrib/git-jump/git-jump | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
index 47e0c557e6..6cf16e0f32 100755
--- a/contrib/git-jump/git-jump
+++ b/contrib/git-jump/git-jump
@@ -41,8 +41,10 @@ open_editor() {
 	esac
 }
 
-mode_diff() {
-	git diff --no-prefix --relative "$@" |
+do_diff() {
+	cmd=$1
+	shift
+	git "$cmd" --no-prefix --relative "$@" |
 	perl -ne '
 	if (m{^\+\+\+ (.*)}) { $file = $1; next }
 	defined($file) or next;
@@ -56,6 +58,14 @@ mode_diff() {
 	'
 }
 
+mode_diff() {
+	do_diff diff "$@"
+}
+
+mode_show() {
+	do_diff show "$@"
+}
+
 mode_merge() {
 	git ls-files -u "$@" |
 	perl -pe 's/^.*?\t//' |

base-commit: 25673b1c476756ec0587fb0596ab3c22b96dc52a
-- 
2.39.3 (Apple Git-145)


             reply	other threads:[~2024-08-14 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 20:07 Geoffrey Thomas [this message]
2024-08-14 21:10 ` [PATCH 1/1] git jump: support show Eric Sunshine
2024-08-15  0:42 ` Jeff King

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

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

  git send-email \
    --in-reply-to=20240814200709.53450-1-geofft@ldpreload.com \
    --to=geofft@ldpreload.com \
    --cc=git@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox