Skip to content

Commit bece812

Browse files
derrickstoleevdye
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 f7a81b8 commit bece812

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

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

2288-
if (params->b_is_post && params->object_count > 1)
2290+
if (params->b_is_post)
22892291
create_tempfile_for_packfile(params, status);
2290-
else
2291-
create_tempfile_for_loose(params, status);
2292+
2293+
create_tempfile_for_loose(params, status);
22922294

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

0 commit comments

Comments
 (0)