Skip to content

Commit f394fd7

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 50ca17c commit f394fd7

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
@@ -1128,7 +1128,9 @@ static void gh__run_one_slot(struct active_request_slot *slot,
11281128
stop_progress(&params->progress);
11291129

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

2293-
if (params->b_is_post && params->object_count > 1)
2295+
if (params->b_is_post)
22942296
create_tempfile_for_packfile(params, status);
2295-
else
2296-
create_tempfile_for_loose(params, status);
2297+
2298+
create_tempfile_for_loose(params, status);
22972299

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

0 commit comments

Comments
 (0)