[PATCH 10/8] [DO NOT APPLY, but improve?] rebase--interactive: introduce "stop" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jake suggested using "x false" instead of "edit" for some corner cases.

I do prefer using "x false" for all kinds of things such as stopping
before a commit (edit only let's you stop after a commit), and the
knowledge that "x false" does the least amount of actions behind my back.

We should have that command as well, maybe?

Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 git-rebase--interactive.sh |  1 +
 sequencer.c                | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3cd7446d0b..9eac53f0c5 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -166,6 +166,7 @@ l, label <label>= label current HEAD with a name
 t, reset <label> = reset HEAD to a label
 b, bud = reset HEAD to the revision labeled 'onto', no arguments
 m, merge [<label-or-commit>]* = create a merge commit using a given commit's message
+y, stay = stop for  shortcut for
 
 These lines can be re-ordered; they are executed from top to bottom.
 " | git stripspace --comment-lines >>"$todo"
diff --git a/sequencer.c b/sequencer.c
index 2b4e6b1232..4b3b9fe59d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -782,6 +782,7 @@ enum todo_command {
 	TODO_RESET,
 	TODO_BUD,
 	TODO_MERGE,
+	TODO_STOP,
 	/* commands that do nothing but are counted for reporting progress */
 	TODO_NOOP,
 	TODO_DROP,
@@ -803,6 +804,7 @@ static struct {
 	{ 'l', "label" },
 	{ 't', "reset" },
 	{ 'b', "bud" },
+	{ 'y', "stay" },
 	{ 'm', "merge" },
 	{ 0,   "noop" },
 	{ 'd', "drop" },
@@ -1307,6 +1309,12 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
 		return 0;
 	}
 
+	if (item->command == TODO_STOP) {
+		item->commit = NULL;
+		item->arg = "";
+		item->arg_len = 0;
+	}
+
 	end_of_object_name = (char *) bol + strcspn(bol, " \t\n");
 	item->arg = end_of_object_name + strspn(end_of_object_name, " \t");
 	item->arg_len = (int)(eol - item->arg);
@@ -2407,6 +2415,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
 				/* `current` will be incremented below */
 				todo_list->current = -1;
 			}
+		} else if (item->command == TODO_STOP) {
+			todo_list->current = -1;
 		} else if (item->command == TODO_LABEL)
 			res = do_label(item->arg, item->arg_len);
 		else if (item->command == TODO_RESET)
-- 
2.16.0.rc1.238.g530d649a79-goog




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux