Skip to content

Commit 8c40f07

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 e3e0fe5 commit 8c40f07

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);
@@ -2288,10 +2290,10 @@ static void do_req(const char *url_base,
22882290
if (params->tempfile)
22892291
delete_tempfile(&params->tempfile);
22902292

2291-
if (params->b_is_post && params->object_count > 1)
2293+
if (params->b_is_post)
22922294
create_tempfile_for_packfile(params, status);
2293-
else
2294-
create_tempfile_for_loose(params, status);
2295+
2296+
create_tempfile_for_loose(params, status);
22952297

22962298
if (!params->tempfile || status->ec != GH__ERROR_CODE__OK)
22972299
return;

0 commit comments

Comments
 (0)