Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPratik Karki <predatoramigo@gmail.com>2018-09-05 01:00:09 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-11 08:12:45 +0300
commit92d0d74e8d703d0f9c0bce779d5e25bb3c25f7df (patch)
treef79250455ba93671a59f5db265c578f5fd1a2b69 /builtin/rebase.c
parent103148aad80ee7ab65b902d77d964260cfd3f6ea (diff)
builtin rebase: support `fork-point` option
This commit adds support for `--fork-point` and `--no-fork-point`. This is converted as-is from `git-legacy-rebase.sh`. Signed-off-by: Pratik Karki <predatoramigo@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 43b46998da..04d830408b 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -632,6 +632,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
struct string_list whitespace = STRING_LIST_INIT_NODUP;
struct string_list exec = STRING_LIST_INIT_NODUP;
const char *rebase_merges = NULL;
+ int fork_point = -1;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
N_("revision"),
@@ -715,6 +716,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
N_("mode"),
N_("try to rebase merges instead of skipping them"),
PARSE_OPT_OPTARG, NULL, (intptr_t)""},
+ OPT_BOOL(0, "fork-point", &fork_point,
+ N_("use 'merge-base --fork-point' to refine upstream")),
OPT_END(),
};
@@ -1063,6 +1066,14 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} else
BUG("unexpected number of arguments left to parse");
+ if (fork_point > 0) {
+ struct commit *head =
+ lookup_commit_reference(the_repository,
+ &options.orig_head);
+ options.restrict_revision =
+ get_fork_point(options.upstream_name, head);
+ }
+
if (read_index(the_repository->index) < 0)
die(_("could not read index"));