From 017303eb483c48515095abcabf024101951f82ae Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 22 Mar 2022 17:28:38 +0000 Subject: bundle: move capabilities to end of 'verify' The 'filter' capability was added in 105c6f14a (bundle: parse filter capability, 2022-03-09), but was added in a strange place in the 'git bundle verify' output. The tests for this show output like the following: The bundle contains these 2 refs: The bundle uses this filter: blob:none The bundle records a complete history. This looks very odd if we have a thin bundle that contains boundary commits instead of a complete history: The bundle contains these 2 refs: The bundle uses this filter: blob:none The bundle requires these 2 refs: This separation between tip refs and boundary refs is unfortunate. Move the filter capability output to the end of the output. Update the documentation to match. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- t/t6020-bundle-misc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh index ed95d19542..c4ab1367af 100755 --- a/t/t6020-bundle-misc.sh +++ b/t/t6020-bundle-misc.sh @@ -510,8 +510,8 @@ do refs/tags/v2 refs/tags/v3 HEAD - The bundle uses this filter: $filter The bundle records a complete history. + The bundle uses this filter: $filter EOF test_cmp expect actual && -- cgit v1.2.3 From 8ba221e2453658f8843176cc00fc5cfe36e07b41 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 22 Mar 2022 17:28:39 +0000 Subject: bundle: output hash information in 'verify' The previous change moved the 'filter' capability to the end of the 'git bundle verify' output. Now, add the 'object-format' capability to the output, when it exists. This change makes 'git bundle verify' output the hash used in all cases, even if the capability is not in the bundle. This means that v2 bundles will always output that they use "sha1". This might look noisy to some users, but it does simplify the implementation and the test strategy for this feature. Since 'verify' ends early when a prerequisite commit is missing, we need to insert this hash message carefully into our expected test output throughout t6020. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- t/t6020-bundle-misc.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 't') diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh index c4ab1367af..833205125a 100755 --- a/t/t6020-bundle-misc.sh +++ b/t/t6020-bundle-misc.sh @@ -122,6 +122,8 @@ format_and_save_expect () { sed -e 's/Z$//' >expect } +HASH_MESSAGE="The bundle uses this hash algorithm: $GIT_DEFAULT_HASH" + # (C) (D, pull/1/head, topic/1) # o --- o # / \ (L) @@ -194,11 +196,12 @@ test_expect_success 'create bundle from special rev: main^!' ' git bundle verify special-rev.bdl | make_user_friendly_and_stable_output >actual && - format_and_save_expect <<-\EOF && + format_and_save_expect <<-EOF && The bundle contains this ref: refs/heads/main The bundle requires this ref: Z + $HASH_MESSAGE EOF test_cmp expect actual && @@ -215,12 +218,13 @@ test_expect_success 'create bundle with --max-count option' ' git bundle verify max-count.bdl | make_user_friendly_and_stable_output >actual && - format_and_save_expect <<-\EOF && + format_and_save_expect <<-EOF && The bundle contains these 2 refs: refs/heads/main refs/tags/v1 The bundle requires this ref: Z + $HASH_MESSAGE EOF test_cmp expect actual && @@ -240,7 +244,7 @@ test_expect_success 'create bundle with --since option' ' git bundle verify since.bdl | make_user_friendly_and_stable_output >actual && - format_and_save_expect <<-\EOF && + format_and_save_expect <<-EOF && The bundle contains these 5 refs: refs/heads/main refs/heads/release @@ -250,6 +254,7 @@ test_expect_success 'create bundle with --since option' ' The bundle requires these 2 refs: Z Z + $HASH_MESSAGE EOF test_cmp expect actual && @@ -267,11 +272,12 @@ test_expect_success 'create bundle 1 - no prerequisites' ' EOF git bundle create stdin-1.bdl --stdin expect <<-\EOF && + format_and_save_expect <<-EOF && The bundle contains these 2 refs: refs/heads/topic/1 refs/heads/topic/2 The bundle records a complete history. + $HASH_MESSAGE EOF # verify bundle, which has no prerequisites @@ -308,13 +314,14 @@ test_expect_success 'create bundle 2 - has prerequisites' ' --stdin \ release refs/heads/release The bundle requires these 3 refs: Z Z Z + $HASH_MESSAGE EOF git bundle verify 2.bdl | @@ -367,13 +374,14 @@ test_expect_success 'create bundle 3 - two refs, same object' ' --stdin \ main HEAD refs/heads/main HEAD The bundle requires these 2 refs: Z Z + $HASH_MESSAGE EOF git bundle verify 3.bdl | @@ -409,12 +417,13 @@ test_expect_success 'create bundle 4 - with tags' ' --stdin \ --all expect <<-\EOF && + cat >expect <<-EOF && The bundle contains these 3 refs: refs/tags/v1 refs/tags/v2 refs/tags/v3 The bundle records a complete history. + $HASH_MESSAGE EOF git bundle verify 4.bdl | @@ -511,6 +520,7 @@ do refs/tags/v3 HEAD The bundle records a complete history. + $HASH_MESSAGE The bundle uses this filter: $filter EOF test_cmp expect actual && -- cgit v1.2.3