summaryrefslogtreecommitdiff
path: root/sequencer.h
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2020-01-24 15:05:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-24 18:29:42 (GMT)
commit767a9c417eb2109dda71995c8fb8a884d3a35e6f (patch)
tree729b1dc78ec3e40d76024cf826f7bf8134a4a5a1 /sequencer.h
parenta7312d1a28ff3ab0a5a5427b35f01d943103cba8 (diff)
downloadgit-767a9c417eb2109dda71995c8fb8a884d3a35e6f.zip
git-767a9c417eb2109dda71995c8fb8a884d3a35e6f.tar.gz
git-767a9c417eb2109dda71995c8fb8a884d3a35e6f.tar.bz2
rebase -i: stop checking out the tip of the branch to rebase
One of the first things done when using a sequencer-based rebase (ie. `rebase -i', `rebase -r', or `rebase -m') is to make a todo list. This requires knowledge of the commit range to rebase. To get the oid of the last commit of the range, the tip of the branch to rebase is checked out with prepare_branch_to_be_rebased(), then the oid of the head is read. After this, the tip of the branch is not even modified. The `am' backend, on the other hand, does not check out the branch. On big repositories, it's a performance penalty: with `rebase -i', the user may have to wait before editing the todo list while git is extracting the branch silently, and "quiet" rebases will be slower than `am'. Since we already have the oid of the tip of the branch in `opts->orig_head', it's useless to switch to this commit. This removes the call to prepare_branch_to_be_rebased() in do_interactive_rebase(), and adds a `orig_head' parameter to get_revision_ranges(). prepare_branch_to_be_rebased() is removed as it is no longer used. This introduces a visible change: as we do not switch on the tip of the branch to rebase, no reflog entry is created at the beginning of the rebase for it. Unscientific performance measurements, performed on linux.git, are as follow: Before this patch: $ time git rebase -m --onto v4.18 463fa44eec2fef50~ 463fa44eec2fef50 real 0m8,940s user 0m6,830s sys 0m2,121s After this patch: $ time git rebase -m --onto v4.18 463fa44eec2fef50~ 463fa44eec2fef50 real 0m1,834s user 0m0,916s sys 0m0,206s Reported-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.h')
-rw-r--r--sequencer.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/sequencer.h b/sequencer.h
index 6704acb..0a97a8d 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -184,9 +184,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,