summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2018-08-28 12:10:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-29 20:38:18 (GMT)
commitf22e4e1a3c2faaac59099aaca15641c18f478f77 (patch)
tree83784454592c4bbf48af25b28c58acd9c8f284ca /git-rebase--interactive.sh
parent6ab54d17be3f51153444d8efebb0ae363eb9b7c9 (diff)
downloadgit-f22e4e1a3c2faaac59099aaca15641c18f478f77.zip
git-f22e4e1a3c2faaac59099aaca15641c18f478f77.tar.gz
git-f22e4e1a3c2faaac59099aaca15641c18f478f77.tar.bz2
rebase -i: rewrite the rest of init_revisions_and_shortrevisions() in C
This rewrites the part of init_revisions_and_shortrevisions() needed by `--complete-action` (which initialize $shortrevisions) from shell to C. When `upstream` is empty, it means that the user launched a `rebase --root`, and `onto` contains the ID of an empty commit. As a range between an empty commit and `head` is not really meaningful, `onto` is not used to initialize `shortrevisions` in this case. The corresponding arguments passed to `--complete-action` are then dropped, and init_revisions_and_shortrevisions() is stripped from git-rebase--interactive.sh Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r--git-rebase--interactive.sh27
1 files changed, 4 insertions, 23 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4ca47ae..08e9a21 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -60,23 +60,6 @@ init_basic_state () {
write_basic_state
}
-init_revisions_and_shortrevisions () {
- shorthead=$(git rev-parse --short $orig_head)
- shortonto=$(git rev-parse --short $onto)
- if test -z "$rebase_root"
- # this is now equivalent to ! -z "$upstream"
- then
- shortupstream=$(git rev-parse --short $upstream)
- revisions=$upstream...$orig_head
- shortrevisions=$shortupstream..$shorthead
- else
- revisions=$onto...$orig_head
- shortrevisions=$shorthead
- test -z "$squash_onto" ||
- echo "$squash_onto" >"$state_dir"/squash-onto
- fi
-}
-
git_rebase__interactive () {
initiate_action "$action"
ret=$?
@@ -87,8 +70,6 @@ git_rebase__interactive () {
git rebase--helper --prepare-branch "$switch_to" ${verbose:+--verbose}
init_basic_state
- init_revisions_and_shortrevisions
-
git rebase--helper --make-script ${keep_empty:+--keep-empty} \
${rebase_merges:+--rebase-merges} \
${rebase_cousins:+--rebase-cousins} \
@@ -97,8 +78,8 @@ git_rebase__interactive () {
${restrict_revision:+--restrict-revision ^"$restrict_revision"} >"$todo" ||
die "$(gettext "Could not generate todo list")"
- exec git rebase--helper --complete-action "$shortrevisions" "$onto_name" \
- "$shortonto" "$orig_head" "$cmd" $allow_empty_message \
- ${autosquash:+--autosquash} ${keep_empty:+--keep-empty} \
- ${verbose:+--verbose} ${force_rebase:+--no-ff}
+ exec git rebase--helper --complete-action "$onto_name" "$cmd" \
+ $allow_empty_message ${autosquash:+--autosquash} ${verbose:+--verbose} \
+ ${keep_empty:+--keep-empty} ${force_rebase:+--no-ff} \
+ ${upstream:+--upstream "$upstream"} ${onto:+--onto "$onto"}
}