rebase: fix docs about incompatibilities with --root

In commit 5dacd4abdd ("git-rebase.txt: document incompatible options", 2018-06-25), I added notes about incompatibilities between options for the apply and merge backends. Unfortunately, I inverted the condition when --root was incompatible with the apply backend. Fix the documentation, and add a testcase that verifies the documentation matches the code. While at it, the documentation for --root also tried to cover some of the backend differences between the apply and merge backends in relation to reapplying cherry picks. The information: * assumed that the apply backend was the default (it isn't anymore) * was written before --reapply-cherry-picks became an option * was written before the detailed information on backend differences All of these factors make the sentence under --root about reapplying cherry picks contradict information that is now available elsewhere in the manual, and the other references are correct. So just strike this sentence. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jan 25, 2023 at 04:03 UTC b8ad365640192706e6742f47302e69e7aea62faf
2 files changed +6 -5
Documentation/git-rebase.txt
+2 -5
@@ -574,10 +574,7 @@ See also INCOMPATIBLE OPTIONS below.
574 --root::
575 Rebase all commits reachable from `<branch>`, instead of
576 limiting them with an `<upstream>`. This allows you to rebase
577 - the root commit(s) on a branch. When used with `--onto`, it
578 - will skip changes already contained in `<newbase>` (instead of
579 - `<upstream>`) whereas without `--onto` it will operate on every
580 - change.
577 + the root commit(s) on a branch.
578 +
579 See also INCOMPATIBLE OPTIONS below.
580
@@ -656,7 +653,7 @@ are incompatible with the following options:
653 * --reapply-cherry-picks
654 * --edit-todo
655 * --update-refs
659 - * --root when used in combination with --onto
656 + * --root when used without --onto
657
658 In addition, the following pairs of options are incompatible:
659
t/t3422-rebase-incompatible-options.sh
+4
@@ -65,6 +65,10 @@ test_rebase_am_only () {
65 test_must_fail git rebase $opt --update-refs A
66 "
67
68 + test_expect_success "$opt incompatible with --root without --onto" "
69 + git checkout B^0 &&
70 + test_must_fail git rebase $opt --root A
71 + "
72 }
73
74 # Check options which imply --apply