Skip to content

Commit 5e3e65a

Browse files
derrickstoleedscho
authored andcommitted
gvfs-helper: handle pack-file after single POST request
If our POST request includes a commit ID, then the the remote will send a pack-file containing the commit and all trees reachable from its root tree. With the current implementation, this causes a failure since we call install_loose() when asking for one object. Modify the condition to check for install_pack() when the response type changes. Also, create a tempfile for the pack-file download or else we will have problems! Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
1 parent 0e32026 commit 5e3e65a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎gvfs-helper.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,9 @@ static void gh__run_one_slot(struct active_request_slot *slot,
11301130
stop_progress(&params->progress);
11311131

11321132
if (status->ec == GH__ERROR_CODE__OK && params->b_write_to_file) {
1133-
if (params->b_is_post && params->object_count > 1)
1133+
if (params->b_is_post &&
1134+
!strcmp(status->content_type.buf,
1135+
"application/x-git-packfile"))
11341136
install_packfile(params, status);
11351137
else
11361138
install_loose(params, status);
@@ -2292,10 +2294,10 @@ static void do_req(const char *url_base,
22922294
if (params->tempfile)
22932295
delete_tempfile(&params->tempfile);
22942296

2295-
if (params->b_is_post && params->object_count > 1)
2297+
if (params->b_is_post)
22962298
create_tempfile_for_packfile(params, status);
2297-
else
2298-
create_tempfile_for_loose(params, status);
2299+
2300+
create_tempfile_for_loose(params, status);
22992301

23002302
if (!params->tempfile || status->ec != GH__ERROR_CODE__OK)
23012303
return;

0 commit comments

Comments
 (0)