diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-27 09:19:59 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-27 09:19:59 -0700 |
| commit | b781a3e08eb0db24fbc966df7c5b6c266c3683af (patch) | |
| tree | 1306f01b72469f13120e7d47f952555c4a6860c7 | |
| parent | Merge branch 'rs/remove-unused-find-header-mem' (diff) | |
| parent | fetch-pack: fix segfault when fscking without --lock-pack (diff) | |
| download | git-b781a3e08eb0db24fbc966df7c5b6c266c3683af.tar.gz git-b781a3e08eb0db24fbc966df7c5b6c266c3683af.zip | |
Merge branch 'jk/fetch-pack-fsck-wo-lock-pack'
"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
| -rw-r--r-- | fetch-pack.c | 4 | ||||
| -rwxr-xr-x | t/t5500-fetch-pack.sh | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index eba9e420ea..42f48fbc31 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -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); } diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index b26f367620..585ea0ee16 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -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 && |
