From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, avarab@gmail.com,
Derrick Stolee <derrickstolee@github.com>,
Derrick Stolee <derrickstolee@github.com>
Subject: [PATCH 5/5] bundle: output hash information in 'verify'
Date: Tue, 22 Mar 2022 17:28:39 +0000 [thread overview]
Message-ID: <b3c9e6523a5466bd8949c77b480c74881edade2f.1647970119.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1186.git.1647970119.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>
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 <derrickstolee@github.com>
---
bundle.c | 2 ++
t/t6020-bundle-misc.sh | 24 +++++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/bundle.c b/bundle.c
index 276b55f8ce2..d50cfb5aa7e 100644
--- a/bundle.c
+++ b/bundle.c
@@ -278,6 +278,8 @@ int verify_bundle(struct repository *r,
list_refs(r, 0, NULL);
}
+ printf_ln("The bundle uses this hash algorithm: %s",
+ header->hash_algo->name);
if (header->filter.choice)
printf_ln("The bundle uses this filter: %s",
list_objects_filter_spec(&header->filter));
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index c4ab1367afc..833205125ab 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:
<COMMIT-P> refs/heads/main
The bundle requires this ref:
<COMMIT-O> 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:
<COMMIT-P> refs/heads/main
<TAG-1> refs/tags/v1
The bundle requires this ref:
<COMMIT-O> 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:
<COMMIT-P> refs/heads/main
<COMMIT-N> refs/heads/release
@@ -250,6 +254,7 @@ test_expect_success 'create bundle with --since option' '
The bundle requires these 2 refs:
<COMMIT-M> Z
<COMMIT-K> 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 <input &&
- cat >expect <<-\EOF &&
+ format_and_save_expect <<-EOF &&
The bundle contains these 2 refs:
<COMMIT-D> refs/heads/topic/1
<COMMIT-H> 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 <input &&
- format_and_save_expect <<-\EOF &&
+ format_and_save_expect <<-EOF &&
The bundle contains this ref:
<COMMIT-N> refs/heads/release
The bundle requires these 3 refs:
<COMMIT-D> Z
<COMMIT-E> Z
<COMMIT-G> 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 <input &&
- format_and_save_expect <<-\EOF &&
+ format_and_save_expect <<-EOF &&
The bundle contains these 2 refs:
<COMMIT-P> refs/heads/main
<COMMIT-P> HEAD
The bundle requires these 2 refs:
<COMMIT-M> Z
<COMMIT-K> Z
+ $HASH_MESSAGE
EOF
git bundle verify 3.bdl |
@@ -409,12 +417,13 @@ test_expect_success 'create bundle 4 - with tags' '
--stdin \
--all <input &&
- cat >expect <<-\EOF &&
+ cat >expect <<-EOF &&
The bundle contains these 3 refs:
<TAG-1> refs/tags/v1
<TAG-2> refs/tags/v2
<TAG-3> refs/tags/v3
The bundle records a complete history.
+ $HASH_MESSAGE
EOF
git bundle verify 4.bdl |
@@ -511,6 +520,7 @@ do
<TAG-3> refs/tags/v3
<COMMIT-P> HEAD
The bundle records a complete history.
+ $HASH_MESSAGE
The bundle uses this filter: $filter
EOF
test_cmp expect actual &&
--
gitgitgadget
next prev parent reply other threads:[~2022-03-22 17:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 17:28 [PATCH 0/5] Partial bundle follow ups Derrick Stolee via GitGitGadget
2022-03-22 17:28 ` [PATCH 1/5] list-objects-filter: remove CL_ARG__FILTER Derrick Stolee via GitGitGadget
2022-03-22 17:28 ` [PATCH 2/5] pack-objects: move revs out of get_object_list() Derrick Stolee via GitGitGadget
2022-03-22 17:28 ` [PATCH 3/5] pack-objects: parse --filter directly into revs.filter Derrick Stolee via GitGitGadget
2022-03-22 19:37 ` [-SPAM-] " Ramsay Jones
2022-03-23 13:48 ` Derrick Stolee
2022-03-22 21:15 ` Ævar Arnfjörð Bjarmason
2022-03-22 17:28 ` [PATCH 4/5] bundle: move capabilities to end of 'verify' Derrick Stolee via GitGitGadget
2022-03-23 7:08 ` Bagas Sanjaya
2022-03-23 13:39 ` Derrick Stolee
2022-03-22 17:28 ` Derrick Stolee via GitGitGadget [this message]
2022-03-23 21:27 ` [PATCH 0/5] Partial bundle follow ups Junio C Hamano
2022-03-25 14:25 ` [PATCH] pack-objects: lazily set up "struct rev_info", don't leak Ævar Arnfjörð Bjarmason
2022-03-25 14:57 ` Derrick Stolee
2022-03-25 16:00 ` Ævar Arnfjörð Bjarmason
2022-03-25 16:41 ` Derrick Stolee
2022-03-25 17:34 ` Ævar Arnfjörð Bjarmason
2022-03-25 19:08 ` Derrick Stolee
2022-03-26 0:52 ` Ævar Arnfjörð Bjarmason
2022-03-28 14:04 ` Derrick Stolee
2022-03-25 18:53 ` Junio C Hamano
2022-03-26 1:09 ` Ævar Arnfjörð Bjarmason
2022-03-28 15:43 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2022-03-28 15:58 ` Derrick Stolee
2022-03-28 17:10 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3c9e6523a5466bd8949c77b480c74881edade2f.1647970119.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=avarab@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).