index-pack: document and test the --promisor option

The --promisor option of 'git index-pack' was created in 88e2f9e (introduce fetch-object: fetch one promisor object, 2017-12-05) but was untested. It is currently unused within the Git codebase, but that will change in an upcoming change to 'git bundle unbundle' when there is a filter capability. For now, add documentation about the option and add a test to ensure it is working as expected. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Mar 9, 2022 at 16:01 UTC 1f52cdfacb6af203cdcc6a5101fc8cb5fff72735
2 files changed +11 -1
Documentation/git-index-pack.txt
+8
@@ -122,6 +122,14 @@ This option cannot be used with --stdin.
122 +
123 include::object-format-disclaimer.txt[]
124
125 +--promisor[=<message>]::
126 + Before committing the pack-index, create a .promisor file for this
127 + pack. Particularly helpful when writing a promisor pack with --fix-thin
128 + since the name of the pack is not final until the pack has been fully
129 + written. If a `<message>` is provided, then that content will be
130 + written to the .promisor file for future reference. See
131 + link:technical/partial-clone.html[partial clone] for more information.
132 +
133 NOTES
134 -----
135
t/t5300-pack-object.sh
+3 -1
@@ -315,8 +315,10 @@ test_expect_success \
315 git index-pack -o tmp.idx test-3.pack &&
316 cmp tmp.idx test-1-${packname_1}.idx &&
317
318 - git index-pack test-3.pack &&
318 + git index-pack --promisor=message test-3.pack &&
319 cmp test-3.idx test-1-${packname_1}.idx &&
320 + echo message >expect &&
321 + test_cmp expect test-3.promisor &&
322
323 cat test-2-${packname_2}.pack >test-3.pack &&
324 git index-pack -o tmp.idx test-2-${packname_2}.pack &&