Skip to content

Commit 3749cce

Browse files
jltoblergitster
authored andcommitted
transport: propagate fsck configuration during bundle fetch
When fetching directly from a bundle, fsck message severity configuration is not propagated to the underlying git-index-pack(1). It is only capable of enabling or disabling fsck checks entirely. This does not align with the fsck behavior for fetches through git-fetch-pack(1). Use the message configuration from fetch-pack and wire it through to `unbundle()` to enable the same fsck configuration as done through fetch-pack. Signed-off-by: Justin Tobler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 683e476 commit 3749cce

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

t/t5607-clone-bundle.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ test_expect_success 'clone bundle with different fsckObjects configurations' '
171171
172172
test_must_fail git -c transfer.fsckObjects=true \
173173
clone bundle-fsck/bad.bundle bundle-transfer-fsck 2>err &&
174+
test_grep "missingEmail" err &&
175+
176+
git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=ignore \
177+
clone bundle-fsck/bad.bundle bundle-fsck-ignore &&
178+
179+
test_must_fail git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=error \
180+
clone bundle-fsck/bad.bundle bundle-fsck-error 2>err &&
174181
test_grep "missingEmail" err
175182
'
176183

transport.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ static int fetch_refs_from_bundle(struct transport *transport,
178178
{
179179
struct verify_bundle_opts opts = { .flags = fetch_pack_fsck_objects() ?
180180
VERIFY_BUNDLE_FSCK : 0 };
181+
struct fetch_pack_options fetch_pack_options = FETCH_PACK_OPTIONS_INIT;
181182
struct bundle_transport_data *data = transport->data;
182183
struct strvec extra_index_pack_args = STRVEC_INIT;
183184
int ret;
@@ -188,11 +189,15 @@ static int fetch_refs_from_bundle(struct transport *transport,
188189
if (!data->get_refs_from_bundle_called)
189190
get_refs_from_bundle_inner(transport);
190191

192+
git_config(fetch_pack_config_cb, &fetch_pack_options);
193+
opts.fsck_msg_types = fetch_pack_options.fsck_msg_types.buf;
194+
191195
ret = unbundle(the_repository, &data->header, data->fd,
192196
&extra_index_pack_args, &opts);
193197
transport->hash_algo = data->header.hash_algo;
194198

195199
strvec_clear(&extra_index_pack_args);
200+
strbuf_release(&fetch_pack_options.fsck_msg_types);
196201
return ret;
197202
}
198203

0 commit comments

Comments
 (0)