Skip to content

Commit

Permalink
Merge branch 'jt/index-pack-allow-promisor-only-while-fetching' into …
Browse files Browse the repository at this point in the history
…next

We now ensure "index-pack" is used with the "--promisor" option
only during a "git fetch".

* jt/index-pack-allow-promisor-only-while-fetching:
  index-pack: teach --promisor to forbid pack name
  • Loading branch information
gitster committed Nov 20, 2024
2 parents 751ee6b + 1f2be8b commit 9bd7657
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Documentation/git-index-pack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ Also, if there are objects in the given pack that references non-promisor
objects (in the repo), repacks those non-promisor objects into a promisor
pack. This avoids a situation in which a repo has non-promisor objects that are
accessible through promisor objects.
+
Requires <pack-file> to not be specified.

NOTES
-----
Expand Down
2 changes: 2 additions & 0 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,8 @@ int cmd_index_pack(int argc,
usage(index_pack_usage);
if (fix_thin_pack && !from_stdin)
die(_("the option '%s' requires '%s'"), "--fix-thin", "--stdin");
if (promisor_msg && pack_name)
die(_("--promisor cannot be used with a pack name"));
if (from_stdin && !startup_info->have_repository)
die(_("--stdin requires a git repository"));
if (from_stdin && hash_algo)
Expand Down
4 changes: 1 addition & 3 deletions t/t5300-pack-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,8 @@ test_expect_success 'build pack index for an existing pack' '
git index-pack -o tmp.idx test-3.pack &&
cmp tmp.idx test-1-${packname_1}.idx &&
git index-pack --promisor=message test-3.pack &&
git index-pack test-3.pack &&
cmp test-3.idx test-1-${packname_1}.idx &&
echo message >expect &&
test_cmp expect test-3.promisor &&
cat test-2-${packname_2}.pack >test-3.pack &&
git index-pack -o tmp.idx test-2-${packname_2}.pack &&
Expand Down

0 comments on commit 9bd7657

Please sign in to comment.