Skip to content

Commit 623b1ab

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 6b467dd commit 623b1ab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

gvfs-helper.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,9 @@ static void gh__run_one_slot(struct active_request_slot *slot,
11271127
stop_progress(&params->progress);
11281128

11291129
if (status->ec == GH__ERROR_CODE__OK && params->b_write_to_file) {
1130-
if (params->b_is_post && params->object_count > 1)
1130+
if (params->b_is_post &&
1131+
!strcmp(status->content_type.buf,
1132+
"application/x-git-packfile"))
11311133
install_packfile(params, status);
11321134
else
11331135
install_loose(params, status);
@@ -2286,10 +2288,10 @@ static void do_req(const char *url_base,
22862288
if (params->tempfile)
22872289
delete_tempfile(&params->tempfile);
22882290

2289-
if (params->b_is_post && params->object_count > 1)
2291+
if (params->b_is_post)
22902292
create_tempfile_for_packfile(params, status);
2291-
else
2292-
create_tempfile_for_loose(params, status);
2293+
2294+
create_tempfile_for_loose(params, status);
22932295

22942296
if (!params->tempfile || status->ec != GH__ERROR_CODE__OK)
22952297
return;

0 commit comments

Comments
 (0)