Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

9 messages, 6 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:49:58

Eric Raible [off-list ref] writes:
On 11:59 AM, Yann Dirson wrote:
quoted
quoted
quoted
I'm sorry if I'm missing something, but how is this different from
"edit"?
Edit cherry-picks a commit, then exits to the shell. I needed to exit
to the shell without cherry-picking a commit.
Indeed, before "x false" was available, I had found out that "edit"
without an argument fails with a harmless error and indeed achieves that
"pause" mechanism which was really missing.

What about just fixing this so we can use "edit" ?  Do we really need
another command here ?
FWIW: +1 for edit.
I like the idea (and I won't fight for my "pause" proposal if others
don't find it intuitive), but I'm wondering how to write the quick
documentation (in the todo-list). And if we don't find a concise way
to document it, it may reveal that it's a bad idea ...

Maybe:

#  e <commit>, edit <commit> = use commit, but stop for amending
#  e, edit = stop for amending

but I find this rather ugly.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Eric Raible <hidden>
Date: 2016-06-15 22:49:58

On 11/4/2010 10:34 AM, Matthieu Moy wrote:
... And if we don't find a concise way
to document it, it may reveal that it's a bad idea ...

Maybe:

#  e <commit>, edit <commit> = use commit, but stop for amending
#  e, edit = stop for amending

but I find this rather ugly.
How about:

#  e [<commit>], edit [<commit>] = use commit (if present) but pause to amend

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:58

Matthieu Moy wrote:
#  e <commit>, edit <commit> = use commit, but stop for amending
#  e, edit = stop for amending
Before it said:

# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  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
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.

How about:

# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command using shell, and stop if it fails
#
# The argument to edit is optional; if left out, it means to
# stop to examine or amend the previous commit.
#
# If you remove a line here, THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
# Use the noop command if you really want to remove all commits.

Ciao,
Jonathan
who is happy to help paint today

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Yann Dirson <hidden>
Date: 2016-06-15 22:49:58

On Thu, Nov 04, 2010 at 01:10:20PM -0500, Jonathan Nieder wrote:
How about:

# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command using shell, and stop if it fails
#
# The argument to edit is optional; if left out, it means to
# stop to examine or amend the previous commit.
#
# If you remove a line here, THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
# Use the noop command if you really want to remove all commits.
That may be too far from the "edit" line, although I do like the idea
of mentionning other uses than "amend".

Eric Raible suggested:
How about:

#  e [<commit>], edit [<commit>] = use commit (if present) but pause to amend
Other commands do not mention commit (or other things) as a synopsis would.
What about:

#  e, edit = use commit (if specified) but pause to amend/examine/test

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Eric Raible <hidden>
Date: 2016-06-15 22:49:58

On 11/4/2010 1:53 PM, Yann Dirson wrote:
Eric Raible suggested:
quoted
How about:

#  e [<commit>], edit [<commit>] = use commit (if present) but pause to amend
Other commands do not mention commit (or other things) as a synopsis would.
What about:

#  e, edit = use commit (if specified) but pause to amend/examine/test
.
I like that color better.

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Kevin Ballard <hidden>
Date: 2016-06-15 22:49:58

On Nov 4, 2010, at 1:53 PM, Yann Dirson wrote:
Eric Raible suggested:
quoted
How about:

#  e [<commit>], edit [<commit>] = use commit (if present) but pause to amend
Other commands do not mention commit (or other things) as a synopsis would.
What about:

#  e, edit = use commit (if specified) but pause to amend/examine/test
I like this. My only remaining concern is the original "shell" version let you
put in a comment (though this was not yet documented) that would be printed when
you were sent back to the shell. This was a useful reminder as to what step you
were on. But when we overload "edit", this functionality is lost. I won't fight
for it if nobody else here thinks it's worthwhile, but I did want to point that
out.

-Kevin Ballard

[PATCHv2] git-rebase--interactive.sh: extend "edit" command to be more useful

From: Kevin Ballard <hidden>
Date: 2016-06-15 22:49:58

Extend the "edit" command to simply stop for editing if no sha1 is
given. This behaves the same as "x false" but is a bit friendlier
for the user.

Signed-off-by: Kevin Ballard <redacted>
---
 git-rebase--interactive.sh |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 9121bb6..a8e00a2 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -477,10 +477,19 @@ do_next () {
 		comment_for_reflog edit
 
 		mark_action_done
-		pick_one $sha1 ||
-			die_with_patch $sha1 "Could not apply $sha1... $rest"
-		echo "$sha1" > "$DOTEST"/stopped-sha
-		make_patch $sha1
+		if test -n "$sha1"; then
+			pick_one $sha1 ||
+				die_with_patch $sha1 "Could not apply $sha1... $rest"
+			echo "$sha1" > "$DOTEST"/stopped-sha
+			make_patch $sha1
+		else
+			# we just want to exit to the shell
+			# we don't have a $sha1 or $rest, so recreate that
+			line=$(git rev-list --pretty=oneline -1 --abbrev-commit --abbrev=7 HEAD)
+			sha1="${line%% *}"
+			rest="${line#* }"
+			echo "$sha1" > "$DOTEST"/stopped-sha
+		fi
 		git rev-parse --verify HEAD > "$AMEND"
 		warn "Stopped at $sha1... $rest"
 		warn "You can amend the commit now, with"
@@ -1003,7 +1012,7 @@ first and then run 'git rebase --continue' again."
 # Commands:
 #  p, pick = use commit
 #  r, reword = use commit, but edit the commit message
-#  e, edit = use commit, but stop for amending
+#  e, edit = use commit (if specified), but pause to amend/examine/test
 #  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
-- 
1.7.3.2.203.gd142e

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:49:59

Am 11/4/2010 21:53, schrieb Yann Dirson:
#  e, edit = use commit (if specified) but pause to amend/examine/test
That's fine. But how would you determine the "if specified"? In
particular, I like to replace the commit subject by instructions that
remember me what I intended to do after rebase stopped, and I would like
to do that in either of these two forms:

e merge foo-topic!

or

e - merge foo-topic!

-- Hannes

Re: [PATCH] git-rebase--interactive.sh: Add new command "shell"

From: Kevin Ballard <hidden>
Date: 2016-06-15 22:49:59

On Nov 5, 2010, at 12:33 AM, Johannes Sixt wrote:
Am 11/4/2010 21:53, schrieb Yann Dirson:
quoted
#  e, edit = use commit (if specified) but pause to amend/examine/test
That's fine. But how would you determine the "if specified"? In
particular, I like to replace the commit subject by instructions that
remember me what I intended to do after rebase stopped, and I would like
to do that in either of these two forms:

e merge foo-topic!

or

e - merge foo-topic!
This was my complaint about overriding "edit" as well, but I kind of like
your second example. Can you come up with a simple way to explain it in
the instructions?

-Kevin Ballard
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help