/* * In this first version, we push all our refs in and start sending * them out. When we get an ACK we hide that commit and continue * traversing until we're done */ int git_fetch_negotiate(git_remote *remote) { int error; git_headarray *list = &remote->refs; git_transport *t = remote->transport; error = filter_wants(remote); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to filter the reference list for wants"); /* Don't try to negotiate when we don't want anything */ if (list->len == 0) return GIT_SUCCESS; if (!remote->need_pack) return GIT_SUCCESS; /* * Now we have everything set up so we can start tell the server * what we want and what we have. */ error = t->send_wants(t, list); if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to send want list"); return t->negotiate_fetch(t, remote->repo, &remote->refs); }
/* * In this first version, we push all our refs in and start sending * them out. When we get an ACK we hide that commit and continue * traversing until we're done */ int git_fetch_negotiate(git_remote *remote) { git_transport *t = remote->transport; if (filter_wants(remote) < 0) { giterr_set(GITERR_NET, "Failed to filter the reference list for wants"); return -1; } /* Don't try to negotiate when we don't want anything */ if (remote->refs.length == 0 || !remote->need_pack) return 0; /* * Now we have everything set up so we can start tell the * server what we want and what we have. */ return t->negotiate_fetch(t, remote->repo, (const git_remote_head * const *)remote->refs.contents, remote->refs.length); }