diff mbox series

[15/23] t5310: add branch-based checks

Message ID 9ab4b94b3573346b31e710486799ab3d95bade8e.1605123653.git.me@ttaylorr.com (mailing list archive)
State Superseded
Headers show
Series pack-bitmap: bitmap generation improvements | expand

Commit Message

Taylor Blau Nov. 11, 2020, 7:43 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

The current rev-list tests that check the bitmap data only work on HEAD
instead of multiple branches. Expand the test cases to handle both
'master' and 'other' branches.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/t5310-pack-bitmaps.sh | 61 +++++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

Comments

Derrick Stolee Nov. 11, 2020, 8:58 p.m. UTC | #1
On 11/11/2020 2:43 PM, Taylor Blau wrote:
> From: Derrick Stolee <dstolee@microsoft.com>
> 
> The current rev-list tests that check the bitmap data only work on HEAD
> instead of multiple branches. Expand the test cases to handle both
> 'master' and 'other' branches.

Adding Johannes to CC since this likely will start colliding with his
default branch rename efforts.

> +rev_list_tests () {
> +	state=$1
> +
> +	for branch in "master" "other"
> +	do
> +		rev_list_tests_head
> +	done
> +}

Specifically, this is a _new_ instance of "master", but all the
other instances of "master" are likely being converted to "main"
in parallel. It would certainly be easier to convert this test
_after_ these changes are applied, but that's unlikely to happen
with the current schedule of things.

Thanks,
-Stolee
Junio C Hamano Nov. 11, 2020, 9:04 p.m. UTC | #2
Derrick Stolee <stolee@gmail.com> writes:

> On 11/11/2020 2:43 PM, Taylor Blau wrote:
>> From: Derrick Stolee <dstolee@microsoft.com>
>> 
>> The current rev-list tests that check the bitmap data only work on HEAD
>> instead of multiple branches. Expand the test cases to handle both
>> 'master' and 'other' branches.
>
> Adding Johannes to CC since this likely will start colliding with his
> default branch rename efforts.
>
>> +rev_list_tests () {
>> +	state=$1
>> +
>> +	for branch in "master" "other"
>> +	do
>> +		rev_list_tests_head
>> +	done
>> +}
>
> Specifically, this is a _new_ instance of "master", but all the
> other instances of "master" are likely being converted to "main"
> in parallel. It would certainly be easier to convert this test
> _after_ these changes are applied, but that's unlikely to happen
> with the current schedule of things.

In some tests, it may make sense to configure init.defaultbranchname
in $HOME/.gitconfig upfront and either (1) leave instances of
'master' as they are (we may want to avoid 'slave', but 'master' is
not all that wrong), or (2) rewrite instances of 'master' to 'main'
(or 'primary' or whatever init.defaultbranchname gets configured).
Johannes Schindelin Nov. 15, 2020, 11:26 p.m. UTC | #3
Hi Junio,

On Wed, 11 Nov 2020, Junio C Hamano wrote:

> Derrick Stolee <stolee@gmail.com> writes:
>
> > On 11/11/2020 2:43 PM, Taylor Blau wrote:
> >> From: Derrick Stolee <dstolee@microsoft.com>
> >>
> >> The current rev-list tests that check the bitmap data only work on HEAD
> >> instead of multiple branches. Expand the test cases to handle both
> >> 'master' and 'other' branches.
> >
> > Adding Johannes to CC since this likely will start colliding with his
> > default branch rename efforts.

It's okay. It's not like this is the only topic I have to navigate around.

> >> +rev_list_tests () {
> >> +	state=$1
> >> +
> >> +	for branch in "master" "other"
> >> +	do
> >> +		rev_list_tests_head
> >> +	done
> >> +}
> >
> > Specifically, this is a _new_ instance of "master", but all the
> > other instances of "master" are likely being converted to "main"
> > in parallel. It would certainly be easier to convert this test
> > _after_ these changes are applied, but that's unlikely to happen
> > with the current schedule of things.
>
> In some tests, it may make sense to configure init.defaultbranchname
> in $HOME/.gitconfig upfront and either (1) leave instances of
> 'master' as they are (we may want to avoid 'slave', but 'master' is
> not all that wrong), or (2) rewrite instances of 'master' to 'main'
> (or 'primary' or whatever init.defaultbranchname gets configured).

I explored this option very early on (so long ago that I failed to mention
it). The problem with that is that `$HOME` is set thusly in `test-lib.sh`:

	HOME="$TRASH_DIRECTORY"

In other words, the test repository's top-level directory is the home
directory. Which means that `git status`, when run directly after `.
test-lib.sh` would already show `.gitignore` as untracked, something that
would trip up a couple of test scripts.

Ciao,
Dscho
diff mbox series

Patch

diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 70a4fc4843..6bf68fee85 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -41,63 +41,70 @@  test_expect_success 'rev-list --test-bitmap verifies bitmaps' '
 	git rev-list --test-bitmap HEAD
 '
 
-rev_list_tests() {
-	state=$1
-
-	test_expect_success "counting commits via bitmap ($state)" '
-		git rev-list --count HEAD >expect &&
-		git rev-list --use-bitmap-index --count HEAD >actual &&
+rev_list_tests_head () {
+	test_expect_success "counting commits via bitmap ($state, $branch)" '
+		git rev-list --count $branch >expect &&
+		git rev-list --use-bitmap-index --count $branch >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "counting partial commits via bitmap ($state)" '
-		git rev-list --count HEAD~5..HEAD >expect &&
-		git rev-list --use-bitmap-index --count HEAD~5..HEAD >actual &&
+	test_expect_success "counting partial commits via bitmap ($state, $branch)" '
+		git rev-list --count $branch~5..$branch >expect &&
+		git rev-list --use-bitmap-index --count $branch~5..$branch >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "counting commits with limit ($state)" '
-		git rev-list --count -n 1 HEAD >expect &&
-		git rev-list --use-bitmap-index --count -n 1 HEAD >actual &&
+	test_expect_success "counting commits with limit ($state, $branch)" '
+		git rev-list --count -n 1 $branch >expect &&
+		git rev-list --use-bitmap-index --count -n 1 $branch >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "counting non-linear history ($state)" '
+	test_expect_success "counting non-linear history ($state, $branch)" '
 		git rev-list --count other...master >expect &&
 		git rev-list --use-bitmap-index --count other...master >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "counting commits with limiting ($state)" '
-		git rev-list --count HEAD -- 1.t >expect &&
-		git rev-list --use-bitmap-index --count HEAD -- 1.t >actual &&
+	test_expect_success "counting commits with limiting ($state, $branch)" '
+		git rev-list --count $branch -- 1.t >expect &&
+		git rev-list --use-bitmap-index --count $branch -- 1.t >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "counting objects via bitmap ($state)" '
-		git rev-list --count --objects HEAD >expect &&
-		git rev-list --use-bitmap-index --count --objects HEAD >actual &&
+	test_expect_success "counting objects via bitmap ($state, $branch)" '
+		git rev-list --count --objects $branch >expect &&
+		git rev-list --use-bitmap-index --count --objects $branch >actual &&
 		test_cmp expect actual
 	'
 
-	test_expect_success "enumerate commits ($state)" '
-		git rev-list --use-bitmap-index HEAD >actual &&
-		git rev-list HEAD >expect &&
+	test_expect_success "enumerate commits ($state, $branch)" '
+		git rev-list --use-bitmap-index $branch >actual &&
+		git rev-list $branch >expect &&
 		test_bitmap_traversal --no-confirm-bitmaps expect actual
 	'
 
-	test_expect_success "enumerate --objects ($state)" '
-		git rev-list --objects --use-bitmap-index HEAD >actual &&
-		git rev-list --objects HEAD >expect &&
+	test_expect_success "enumerate --objects ($state, $branch)" '
+		git rev-list --objects --use-bitmap-index $branch >actual &&
+		git rev-list --objects $branch >expect &&
 		test_bitmap_traversal expect actual
 	'
 
-	test_expect_success "bitmap --objects handles non-commit objects ($state)" '
-		git rev-list --objects --use-bitmap-index HEAD tagged-blob >actual &&
+	test_expect_success "bitmap --objects handles non-commit objects ($state, $branch)" '
+		git rev-list --objects --use-bitmap-index $branch tagged-blob >actual &&
 		grep $blob actual
 	'
 }
 
+rev_list_tests () {
+	state=$1
+
+	for branch in "master" "other"
+	do
+		rev_list_tests_head
+	done
+}
+
 rev_list_tests 'full bitmap'
 
 test_expect_success 'clone from bitmapped repository' '