Skip to content

Commit a527370

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 <[email protected]>
1 parent 25c4456 commit a527370

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

gvfs-helper.c

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

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

2294-
if (params->b_is_post && params->object_count > 1)
2296+
if (params->b_is_post)
22952297
create_tempfile_for_packfile(params, status);
2296-
else
2297-
create_tempfile_for_loose(params, status);
2298+
2299+
create_tempfile_for_loose(params, status);
22982300

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

0 commit comments

Comments
 (0)