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: <COMMIT1> <REF1> <COMMIT2> <REF2> 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: <COMMIT1> <REF1> <COMMIT2> <REF2> The bundle uses this filter: blob:none The bundle requires these 2 refs: <COMMIT3> <COMMIT4> 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 <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Mar 22, 2022 at 17:28 UTC 017303eb483c48515095abcabf024101951f82ae
3 files changed +10 -11
Documentation/git-bundle.txt
+5 -5
@@ -75,11 +75,11 @@ verify <file>::
75 cleanly to the current repository. This includes checks on the
76 bundle format itself as well as checking that the prerequisite
77 commits exist and are fully linked in the current repository.
78 - Information about additional capabilities, such as "object filter",
79 - is printed. See "Capabilities" in link:technical/bundle-format.html
80 - for more information. Finally, 'git bundle' prints a list of
81 - missing commits, if any. The exit code is zero for success, but
82 - will be nonzero if the bundle file is invalid.
78 + Then, 'git bundle' prints a list of missing commits, if any.
79 + Finally, information about additional capabilities, such as "object
80 + filter", is printed. See "Capabilities" in link:technical/bundle-format.html
81 + for more information. The exit code is zero for success, but will
82 + be nonzero if the bundle file is invalid.
83
84 list-heads <file>::
85 Lists the references defined in the bundle. If followed by a
bundle.c
+4 -5
@@ -267,11 +267,6 @@ int verify_bundle(struct repository *r,
267 (uintmax_t)r->nr);
268 list_refs(r, 0, NULL);
269
270 - if (header->filter.choice) {
271 - printf_ln("The bundle uses this filter: %s",
272 - list_objects_filter_spec(&header->filter));
273 - }
274 -
270 r = &header->prerequisites;
271 if (!r->nr) {
272 printf_ln(_("The bundle records a complete history."));
@@ -282,6 +277,10 @@ int verify_bundle(struct repository *r,
277 (uintmax_t)r->nr);
278 list_refs(r, 0, NULL);
279 }
280 +
281 + if (header->filter.choice)
282 + printf_ln("The bundle uses this filter: %s",
283 + list_objects_filter_spec(&header->filter));
284 }
285 return ret;
286 }
t/t6020-bundle-misc.sh
+1 -1
@@ -510,8 +510,8 @@ do
510 <TAG-2> refs/tags/v2
511 <TAG-3> refs/tags/v3
512 <COMMIT-P> HEAD
513 - The bundle uses this filter: $filter
513 The bundle records a complete history.
514 + The bundle uses this filter: $filter
515 EOF
516 test_cmp expect actual &&
517