summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/rebase.c18
-rw-r--r--sequencer.c14
-rw-r--r--sequencer.h3
3 files changed, 5 insertions, 30 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 8081741..6154ad8 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -246,21 +246,17 @@ static int edit_todo_file(unsigned flags)
}
static int get_revision_ranges(struct commit *upstream, struct commit *onto,
- const char **head_hash,
+ struct object_id *orig_head, const char **head_hash,
char **revisions, char **shortrevisions)
{
struct commit *base_rev = upstream ? upstream : onto;
const char *shorthead;
- struct object_id orig_head;
-
- if (get_oid("HEAD", &orig_head))
- return error(_("no HEAD?"));
- *head_hash = find_unique_abbrev(&orig_head, GIT_MAX_HEXSZ);
+ *head_hash = find_unique_abbrev(orig_head, GIT_MAX_HEXSZ);
*revisions = xstrfmt("%s...%s", oid_to_hex(&base_rev->object.oid),
*head_hash);
- shorthead = find_unique_abbrev(&orig_head, DEFAULT_ABBREV);
+ shorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);
if (upstream) {
const char *shortrev;
@@ -314,12 +310,8 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
struct replay_opts replay = get_replay_opts(opts);
struct string_list commands = STRING_LIST_INIT_DUP;
- if (prepare_branch_to_be_rebased(the_repository, &replay,
- opts->switch_to))
- return -1;
-
- if (get_revision_ranges(opts->upstream, opts->onto, &head_hash,
- &revisions, &shortrevisions))
+ if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head,
+ &head_hash, &revisions, &shortrevisions))
return -1;
if (init_basic_state(&replay,
diff --git a/sequencer.c b/sequencer.c
index df6d18f..18b2b1f 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3716,20 +3716,6 @@ static int run_git_checkout(struct repository *r, struct replay_opts *opts,
return ret;
}
-int prepare_branch_to_be_rebased(struct repository *r, struct replay_opts *opts,
- const char *commit)
-{
- const char *action;
-
- if (commit && *commit) {
- action = reflog_message(opts, "start", "checkout %s", commit);
- if (run_git_checkout(r, opts, commit, action))
- return error(_("could not checkout %s"), commit);
- }
-
- return 0;
-}
-
static int checkout_onto(struct repository *r, struct replay_opts *opts,
const char *onto_name, const struct object_id *onto,
const char *orig_head)
diff --git a/sequencer.h b/sequencer.h
index 9f9ae29..74f1e26 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -190,9 +190,6 @@ void commit_post_rewrite(struct repository *r,
const struct commit *current_head,
const struct object_id *new_head);
-int prepare_branch_to_be_rebased(struct repository *r, struct replay_opts *opts,
- const char *commit);
-
#define SUMMARY_INITIAL_COMMIT (1 << 0)
#define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
void print_commit_summary(struct repository *repo,