git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pratik Karki <predatoramigo@gmail.com>
To: git@vger.kernel.org
Cc: christian.couder@gmail.com, Johannes.Schindelin@gmx.de,
	sbeller@google.com, alban.gruin@gmail.com, gitster@pobox.com,
	Pratik Karki <predatoramigo@gmail.com>
Subject: [PATCH 2/7] builtin rebase: support --skip
Date: Wed,  8 Aug 2018 20:51:17 +0545	[thread overview]
Message-ID: <20180808150622.9614-3-predatoramigo@gmail.com> (raw)
In-Reply-To: <20180808150622.9614-1-predatoramigo@gmail.com>

This commit adds the option `--skip` which is used to restart
rebase after skipping the current patch.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
---
 builtin/rebase.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 10da4c978b..7a903838b1 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -21,6 +21,7 @@
 #include "diff.h"
 #include "wt-status.h"
 #include "revision.h"
+#include "rerere.h"
 
 static char const * const builtin_rebase_usage[] = {
 	N_("git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] "
@@ -468,6 +469,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 	enum {
 		NO_ACTION,
 		ACTION_CONTINUE,
+		ACTION_SKIP,
 	} action = NO_ACTION;
 	struct option builtin_rebase_options[] = {
 		OPT_STRING(0, "onto", &options.onto_name,
@@ -492,6 +494,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			REBASE_FORCE),
 		OPT_CMDMODE(0, "continue", &action, N_("continue"),
 			    ACTION_CONTINUE),
+		OPT_CMDMODE(0, "skip", &action,
+			    N_("skip current patch and continue"), ACTION_SKIP),
 		OPT_END(),
 	};
 
@@ -590,6 +594,20 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			exit(1);
 		goto run_rebase;
 	}
+	case ACTION_SKIP: {
+		struct string_list merge_rr = STRING_LIST_INIT_DUP;
+
+		options.action = "skip";
+
+		rerere_clear(&merge_rr);
+		string_list_clear(&merge_rr, 1);
+
+		if (reset_head(NULL, "reset", NULL, 0) < 0)
+			die(_("could not discard worktree changes"));
+		if (read_basic_state(&options))
+			exit(1);
+		goto run_rebase;
+	}
 	default:
 		die("TODO");
 	}
-- 
2.18.0


  parent reply	other threads:[~2018-08-08 15:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 15:06 [GSoC] [PATCH 0/7] builtin rebase actions Pratik Karki
2018-08-08 15:06 ` [PATCH 1/7] builtin rebase: support --continue Pratik Karki
2018-08-08 15:06 ` Pratik Karki [this message]
2018-08-08 15:06 ` [PATCH 3/7] builtin rebase: support --abort Pratik Karki
2018-08-08 15:06 ` [PATCH 4/7] builtin rebase: support --quit Pratik Karki
2018-08-08 15:06 ` [PATCH 5/7] builtin rebase: support --edit-todo and --show-current-patch Pratik Karki
2018-08-08 15:06 ` [PATCH 6/7] builtin rebase: actions require a rebase in progress Pratik Karki
2018-08-08 15:06 ` [PATCH 7/7] builtin rebase: stop if `git am` is " Pratik Karki

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=20180808150622.9614-3-predatoramigo@gmail.com \
    --to=predatoramigo@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=alban.gruin@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.com \
    /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).