Skip to content

Commit

Permalink
Merge branch 'jk/fetch-pack-fsck-wo-lock-pack'
Browse files Browse the repository at this point in the history
"git fetch-pack -k -k" without passing "--lock-pack" (which we
never do ourselves) did not work at all, which has been corrected.

* jk/fetch-pack-fsck-wo-lock-pack:
  fetch-pack: fix segfault when fscking without --lock-pack
  • Loading branch information
gitster committed Jun 27, 2024
2 parents 5dce36e + 96a6621 commit b781a3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,10 @@ static int get_pack(struct fetch_pack_args *args,

if (!is_well_formed)
die(_("fetch-pack: invalid index-pack output"));
if (pack_lockfile)
if (pack_lockfiles && pack_lockfile)
string_list_append_nodup(pack_lockfiles, pack_lockfile);
else
free(pack_lockfile);
parse_gitmodules_oids(cmd.out, gitmodules_oids);
close(cmd.out);
}
Expand Down
10 changes: 10 additions & 0 deletions t/t5500-fetch-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,16 @@ test_expect_success 'ensure bogus fetch.negotiationAlgorithm yields error' '
fetch origin server_has both_have_2
'

test_expect_success 'fetch-pack with fsckObjects and keep-file does not segfault' '
rm -rf server client &&
test_create_repo server &&
test_commit -C server one &&
test_create_repo client &&
git -c fetch.fsckObjects=true \
-C client fetch-pack -k -k ../server HEAD
'

test_expect_success 'filtering by size' '
rm -rf server client &&
test_create_repo server &&
Expand Down

0 comments on commit b781a3e

Please sign in to comment.