Skip to content

Commit b781a3e

Browse files
committed
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
2 parents 5dce36e + 96a6621 commit b781a3e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

fetch-pack.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,10 @@ static int get_pack(struct fetch_pack_args *args,
10381038

10391039
if (!is_well_formed)
10401040
die(_("fetch-pack: invalid index-pack output"));
1041-
if (pack_lockfile)
1041+
if (pack_lockfiles && pack_lockfile)
10421042
string_list_append_nodup(pack_lockfiles, pack_lockfile);
1043+
else
1044+
free(pack_lockfile);
10431045
parse_gitmodules_oids(cmd.out, gitmodules_oids);
10441046
close(cmd.out);
10451047
}

t/t5500-fetch-pack.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,16 @@ test_expect_success 'ensure bogus fetch.negotiationAlgorithm yields error' '
993993
fetch origin server_has both_have_2
994994
'
995995

996+
test_expect_success 'fetch-pack with fsckObjects and keep-file does not segfault' '
997+
rm -rf server client &&
998+
test_create_repo server &&
999+
test_commit -C server one &&
1000+
1001+
test_create_repo client &&
1002+
git -c fetch.fsckObjects=true \
1003+
-C client fetch-pack -k -k ../server HEAD
1004+
'
1005+
9961006
test_expect_success 'filtering by size' '
9971007
rm -rf server client &&
9981008
test_create_repo server &&

0 commit comments

Comments
 (0)