git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Ballard <kevin@sb.org>
To: git@vger.kernel.org
Cc: Kevin Ballard <kevin@sb.org>
Subject: [PATCH] git-rebase--interactive.sh: Add new command "shell"
Date: Wed,  3 Nov 2010 22:17:16 -0700	[thread overview]
Message-ID: <1288847836-84882-1-git-send-email-kevin@sb.org> (raw)

Add a new command "shell", which takes an option commit. It simply exits
to the shell with the commit (if given) and a message telling the user how
to resume the rebase. This is effectively the same thing as "x false" but
much friendlier to the user.

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
I discovered the need for this when I wanted to edit a commit, but apply
a fixup first. The only way with the existing tools was an exec command
that fails (e.g. "x false").

 git-rebase--interactive.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 9121bb6..3501757 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -566,6 +566,26 @@ do_next () {
 			exit 1
 		fi
 		;;
+	!|"shell")
+		read -r command comment < "$TODO"
+		mark_action_done
+		# can't use $sha1 here for same reason as "exec"
+		line=$(git rev-list --pretty=oneline -1 --abbrev-commit --abbrev=7 HEAD)
+		sha1="${line%% *}"
+		rest="${line#* }"
+		echo "$sha1" > "$DOTEST"/stopped-sha
+		warn "Stopped at $sha1... $rest"
+		if test -n "$comment"; then
+			warn
+			warn "	$comment"
+		fi
+		warn
+		warn "Once you are ready to continue, run"
+		warn
+		warn "	git rebase --continue"
+		warn
+		exit 0
+		;;
 	*)
 		warn "Unknown command: $command $sha1 $rest"
 		if git rev-parse --verify -q "$sha1" >/dev/null
@@ -1007,6 +1027,7 @@ first and then run 'git rebase --continue' again."
 #  s, squash = use commit, but meld into previous commit
 #  f, fixup = like "squash", but discard this commit's log message
 #  x <cmd>, exec <cmd> = Run a shell command <cmd>, and stop if it fails
+#  !, shell = Exit to the shell
 #
 # If you remove a line here THAT COMMIT WILL BE LOST.
 # However, if you remove everything, the rebase will be aborted.
-- 
1.7.3.2.202.g3b863.dirty

             reply	other threads:[~2010-11-04  5:18 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04  5:17 Kevin Ballard [this message]
2010-11-04  5:22 ` [PATCH] git-rebase--interactive.sh: Add new command "shell" Kevin Ballard
2010-11-04  8:42 ` Matthieu Moy
2010-11-04  8:53   ` Kevin Ballard
2010-11-04  9:23     ` Ævar Arnfjörð Bjarmason
2010-11-04  9:25       ` Kevin Ballard
2010-11-04  9:27         ` Ævar Arnfjörð Bjarmason
2010-11-04 10:24     ` Johannes Sixt
2010-11-04  9:36 ` Erik Faye-Lund
2010-11-04  9:43   ` Kevin Ballard
2010-11-04 10:25     ` Yann Dirson
2010-11-04 10:40       ` Erik Faye-Lund
2010-11-04 17:04       ` Eric Raible
2010-11-04 17:34         ` Matthieu Moy
2010-11-04 17:43           ` Eric Raible
2010-11-04 18:10           ` Jonathan Nieder
2010-11-04 20:53             ` Yann Dirson
2010-11-04 21:05               ` Eric Raible
2010-11-04 22:01                 ` [PATCHv2] git-rebase--interactive.sh: extend "edit" command to be more useful Kevin Ballard
2010-11-04 21:33               ` [PATCH] git-rebase--interactive.sh: Add new command "shell" Kevin Ballard
2010-11-05  7:33               ` Johannes Sixt
2010-11-05  8:39                 ` Kevin Ballard
2010-11-08 18:31               ` Junio C Hamano
2010-11-08 21:49                 ` Kevin Ballard
2010-11-08 22:29                   ` Yann Dirson
2010-11-10  1:42                     ` Jonathan Nieder
2010-11-10  1:46                       ` Kevin Ballard
2010-11-10  1:56                         ` Jonathan Nieder
2010-11-10  7:43                       ` Yann Dirson
2010-11-10 16:00                         ` Matthieu Moy
2010-11-10  1:53                 ` Jonathan Nieder
2010-11-10  2:14                   ` Kevin Ballard
2010-11-24 20:19                   ` [PATCHv3] git-rebase--interactive.sh: extend "edit" command to be more useful Kevin Ballard
2010-12-03  8:06                     ` Jonathan Nieder
2010-12-03  8:16                       ` Kevin Ballard
2010-12-03  8:55                         ` Jonathan Nieder
2010-12-03  9:55                       ` Johannes Sixt
2010-12-03 10:00                         ` Jonathan Nieder
2010-12-03 10:14                           ` Kevin Ballard

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=1288847836-84882-1-git-send-email-kevin@sb.org \
    --to=kevin@sb.org \
    --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;
as well as URLs for NNTP newsgroup(s).