Skip to content

Commit a5cf005

Browse files
Merge pull request git-for-windows#221: 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.
2 parents 0315e44 + 1deef24 commit a5cf005

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

11211121
if (status->ec == GH__ERROR_CODE__OK && params->b_write_to_file) {
1122-
if (params->b_is_post && params->object_count > 1)
1122+
if (params->b_is_post &&
1123+
!strcmp(status->content_type.buf,
1124+
"application/x-git-packfile"))
11231125
install_packfile(params, status);
11241126
else
11251127
install_loose(params, status);
@@ -2200,10 +2202,10 @@ static void do_req(const char *url_base,
22002202
if (params->tempfile)
22012203
delete_tempfile(&params->tempfile);
22022204

2203-
if (params->b_is_post && params->object_count > 1)
2205+
if (params->b_is_post)
22042206
create_tempfile_for_packfile(params, status);
2205-
else
2206-
create_tempfile_for_loose(params, status);
2207+
2208+
create_tempfile_for_loose(params, status);
22072209

22082210
if (!params->tempfile || status->ec != GH__ERROR_CODE__OK)
22092211
return;

0 commit comments

Comments
 (0)