Skip to content

Commit 5cf6e9b

Browse files
committed
Merge branch 'jk/fetch-pack-fsck-wo-lock-pack' into maint-2.45
"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 77a6c4c + 96a6621 commit 5cf6e9b

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
@@ -1036,8 +1036,10 @@ static int get_pack(struct fetch_pack_args *args,
10361036

10371037
if (!is_well_formed)
10381038
die(_("fetch-pack: invalid index-pack output"));
1039-
if (pack_lockfile)
1039+
if (pack_lockfiles && pack_lockfile)
10401040
string_list_append_nodup(pack_lockfiles, pack_lockfile);
1041+
else
1042+
free(pack_lockfile);
10411043
parse_gitmodules_oids(cmd.out, gitmodules_oids);
10421044
close(cmd.out);
10431045
}

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)