mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
rebase -i --root: let the sequencer handle even the initial part
In this developer's earlier attempt to accelerate interactive rebases by
converting large parts from Unix shell script into portable, performant
C, the --root handling was specifically excluded (to simplify the task a
little bit; it still took over a year to get that reduced set of patches
into Git proper).
This patch ties up that loose end: now only --preserve-merges uses the
slow Unix shell script implementation to perform the interactive rebase.
As the rebase--helper reports progress to stderr (unlike the scripted
interactive rebase, which reports it to stdout, of all places), we have
to adjust a couple of tests that did not expect that for `git rebase -i
--root`.
This patch fixes -- at long last! -- the really old bug reported in
6a6bc5bdc4
(add tests for rebasing root, 2013-06-06) that rebasing with
--root *always* rewrote the root commit, even if there were no changes.
The bug still persists in --preserve-merges mode, of course, but that
mode will be deprecated as soon as the new --rebase-merges mode
stabilizes, anyway.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d87d48b2e0
commit
21d0764c82
|
@ -894,6 +894,8 @@ init_revisions_and_shortrevisions () {
|
||||||
else
|
else
|
||||||
revisions=$onto...$orig_head
|
revisions=$onto...$orig_head
|
||||||
shortrevisions=$shorthead
|
shortrevisions=$shorthead
|
||||||
|
test -z "$squash_onto" ||
|
||||||
|
echo "$squash_onto" >"$state_dir"/squash-onto
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,7 +950,7 @@ EOF
|
||||||
die "Could not skip unnecessary pick commands"
|
die "Could not skip unnecessary pick commands"
|
||||||
|
|
||||||
checkout_onto
|
checkout_onto
|
||||||
if test -z "$rebase_root" && test ! -d "$rewritten"
|
if test ! -d "$rewritten"
|
||||||
then
|
then
|
||||||
require_clean_work_tree "rebase"
|
require_clean_work_tree "rebase"
|
||||||
exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
|
exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
|
||||||
|
|
|
@ -1204,10 +1204,6 @@ test_expect_success 'drop' '
|
||||||
test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
|
test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
|
||||||
Successfully rebased and updated refs/heads/missing-commit.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
|
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
|
||||||
test_config rebase.missingCommitsCheck ignore &&
|
test_config rebase.missingCommitsCheck ignore &&
|
||||||
rebase_setup_and_clean missing-commit &&
|
rebase_setup_and_clean missing-commit &&
|
||||||
|
@ -1215,7 +1211,9 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
|
||||||
FAKE_LINES="1 2 3 4" \
|
FAKE_LINES="1 2 3 4" \
|
||||||
git rebase -i --root 2>actual &&
|
git rebase -i --root 2>actual &&
|
||||||
test D = $(git cat-file commit HEAD | sed -ne \$p) &&
|
test D = $(git cat-file commit HEAD | sed -ne \$p) &&
|
||||||
test_i18ncmp expect actual
|
test_i18ngrep \
|
||||||
|
"Successfully rebased and updated refs/heads/missing-commit" \
|
||||||
|
actual
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
|
@ -1227,15 +1225,24 @@ To avoid this message, use "drop" to explicitly remove a commit.
|
||||||
Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
|
Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
|
||||||
The possible behaviours are: ignore, warn, error.
|
The possible behaviours are: ignore, warn, error.
|
||||||
|
|
||||||
|
Rebasing (1/4)
|
||||||
|
Rebasing (2/4)
|
||||||
|
Rebasing (3/4)
|
||||||
|
Rebasing (4/4)
|
||||||
Successfully rebased and updated refs/heads/missing-commit.
|
Successfully rebased and updated refs/heads/missing-commit.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cr_to_nl () {
|
||||||
|
tr '\015' '\012'
|
||||||
|
}
|
||||||
|
|
||||||
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
|
test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
|
||||||
test_config rebase.missingCommitsCheck warn &&
|
test_config rebase.missingCommitsCheck warn &&
|
||||||
rebase_setup_and_clean missing-commit &&
|
rebase_setup_and_clean missing-commit &&
|
||||||
set_fake_editor &&
|
set_fake_editor &&
|
||||||
FAKE_LINES="1 2 3 4" \
|
FAKE_LINES="1 2 3 4" \
|
||||||
git rebase -i --root 2>actual &&
|
git rebase -i --root 2>actual.2 &&
|
||||||
|
cr_to_nl <actual.2 >actual &&
|
||||||
test_i18ncmp expect actual &&
|
test_i18ncmp expect actual &&
|
||||||
test D = $(git cat-file commit HEAD | sed -ne \$p)
|
test D = $(git cat-file commit HEAD | sed -ne \$p)
|
||||||
'
|
'
|
||||||
|
|
|
@ -328,9 +328,9 @@ test_run_rebase () {
|
||||||
test_cmp_rev c HEAD
|
test_cmp_rev c HEAD
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
test_run_rebase failure ''
|
test_run_rebase success ''
|
||||||
test_run_rebase failure -m
|
test_run_rebase success -m
|
||||||
test_run_rebase failure -i
|
test_run_rebase success -i
|
||||||
test_run_rebase failure -p
|
test_run_rebase failure -p
|
||||||
|
|
||||||
test_run_rebase () {
|
test_run_rebase () {
|
||||||
|
|
Loading…
Reference in a new issue