Skip to content

test-gvfs-protocol.c, t5799-gvfs-helper.sh: unit tests for gvfs-helper #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ else
endif

PROGRAM_OBJS += gvfs-helper.o
TEST_PROGRAMS_NEED_X += test-gvfs-protocol

REMOTE_CURL_PRIMARY = git-remote-http$X
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
Expand Down
21 changes: 14 additions & 7 deletions gvfs-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,8 @@ static void install_loose(struct gh__request_params *params,
/*
* We expect a loose object when we do a GET -or- when we
* do a POST with only 1 object.
*
* Note that this content type is singular, not plural.
*/
if (strcmp(status->content_type.buf,
"application/x-git-loose-object")) {
Expand Down Expand Up @@ -2105,14 +2107,17 @@ static void do_throttle_spin(struct gh__request_params *params,
strbuf_addstr(&region, gh__server_type_label[params->server_type]);
trace2_region_enter("gvfs-helper", region.buf, NULL);

progress = start_progress(progress_msg, duration);
if (gh__cmd_opts.show_progress)
progress = start_progress(progress_msg, duration);

while (now < end) {
display_progress(progress, (now - begin));

sleep_millisec(100);

now = time(NULL);
}

display_progress(progress, duration);
stop_progress(&progress);

Expand Down Expand Up @@ -2631,13 +2636,15 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
params.headers = curl_slist_append(params.headers,
"Content-Type: application/json");
/*
* We really always want a packfile. But if the payload only
* requests 1 OID, the server will send us a single loose
* objects instead. (Apparently the server ignores us when we
* only send application/x-git-packfile and does it anyway.)
* If our POST contains more than one object, we want the
* server to send us a packfile. We DO NOT want the non-standard
* concatenated loose object format, so we DO NOT send:
* "Accept: application/x-git-loose-objects" (plural)
*
* So to make it clear to my future self, go ahead and add
* an accept header for loose objects and own it.
* However, if the payload only requests 1 OID, the server
* will send us a single loose object instead of a packfile,
* so we ACK that and send:
* "Accept: application/x-git-loose-object" (singular)
*/
params.headers = curl_slist_append(params.headers,
"Accept: application/x-git-packfile");
Expand Down
Loading