diff mbox series

[5/6] t1092: add cherry-pick, rebase tests

Message ID ca23bf38bd9a88c6ab8461e703165c550cf7b955.1629220124.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Sparse Index: Integrate with merge, cherry-pick, rebase, and revert | expand

Commit Message

Derrick Stolee Aug. 17, 2021, 5:08 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

Add tests to check that cherry-pick and rebase behave the same in the
sparse-index case as in the full index cases.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 t/t1092-sparse-checkout-compatibility.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Elijah Newren Aug. 20, 2021, 9:58 p.m. UTC | #1
On Tue, Aug 17, 2021 at 10:08 AM Derrick Stolee via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Derrick Stolee <dstolee@microsoft.com>
>
> Add tests to check that cherry-pick and rebase behave the same in the
> sparse-index case as in the full index cases.
>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
>  t/t1092-sparse-checkout-compatibility.sh | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
> index a0ed2bec574..a52d2edda54 100755
> --- a/t/t1092-sparse-checkout-compatibility.sh
> +++ b/t/t1092-sparse-checkout-compatibility.sh
> @@ -486,14 +486,17 @@ test_expect_success 'checkout and reset (mixed) [sparse]' '
>         test_sparse_match git reset update-folder2
>  '
>
> -test_expect_success 'merge' '
> +test_expect_success 'merge, cherry-pick, and rebase' '
>         init_repos &&
>
> -       test_all_match git checkout -b merge update-deep &&
> -       test_all_match git merge -m "folder1" update-folder1 &&
> -       test_all_match git rev-parse HEAD^{tree} &&
> -       test_all_match git merge -m "folder2" update-folder2 &&
> -       test_all_match git rev-parse HEAD^{tree}
> +       for OPERATION in "merge -s ort -m merge" cherry-pick rebase

You're explicitly testing the ort strategy with merge, but relying on
GIT_TEST_MERGE_ALGORITHM for cherry-pick and rebase?

It'd probably be better to set GIT_TEST_MERGE_ALGORITHM=ort at the
beginning of the file and leave out the `-s ort` references.

Or, if you really wanted to test both algorithms, then in addition to
leaving out the `-s ort`, don't bother setting
GIT_TEST_MERGE_ALGORITHM.  (That works because automated test suites
will set GIT_TEST_MERGE_ALGORITHM=recursive on linux-gcc, and
GIT_TEST_MERGE_ALGORITHM=ort elsewhere).


> +       do
> +               test_all_match git checkout -B temp update-deep &&
> +               test_all_match git $OPERATION update-folder1 &&
> +               test_all_match git rev-parse HEAD^{tree} &&
> +               test_all_match git $OPERATION update-folder2 &&
> +               test_all_match git rev-parse HEAD^{tree} || return 1
> +       done


>  '
>
>  # NEEDSWORK: This test is documenting current behavior, but that
> --
> gitgitgadget
>
diff mbox series

Patch

diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index a0ed2bec574..a52d2edda54 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -486,14 +486,17 @@  test_expect_success 'checkout and reset (mixed) [sparse]' '
 	test_sparse_match git reset update-folder2
 '
 
-test_expect_success 'merge' '
+test_expect_success 'merge, cherry-pick, and rebase' '
 	init_repos &&
 
-	test_all_match git checkout -b merge update-deep &&
-	test_all_match git merge -m "folder1" update-folder1 &&
-	test_all_match git rev-parse HEAD^{tree} &&
-	test_all_match git merge -m "folder2" update-folder2 &&
-	test_all_match git rev-parse HEAD^{tree}
+	for OPERATION in "merge -s ort -m merge" cherry-pick rebase
+	do
+		test_all_match git checkout -B temp update-deep &&
+		test_all_match git $OPERATION update-folder1 &&
+		test_all_match git rev-parse HEAD^{tree} &&
+		test_all_match git $OPERATION update-folder2 &&
+		test_all_match git rev-parse HEAD^{tree} || return 1
+	done
 '
 
 # NEEDSWORK: This test is documenting current behavior, but that