Commit 2cdd5c57 by Carlos Martín Nieto

remote: store passive refspecs

The configured/base fetch refspecs need to be taken into account in
order to implement opportunistic remote-tracking branch updates. DWIM
them and store them in the struct, but don't do anything with them yet.
parent c300d84a
...@@ -375,6 +375,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name) ...@@ -375,6 +375,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
if (git_vector_init(&remote->refs, 32, NULL) < 0 || if (git_vector_init(&remote->refs, 32, NULL) < 0 ||
git_vector_init(&remote->refspecs, 2, NULL) < 0 || git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
git_vector_init(&remote->passive_refspecs, 2, NULL) < 0 ||
git_vector_init(&remote->active_refspecs, 2, NULL) < 0) { git_vector_init(&remote->active_refspecs, 2, NULL) < 0) {
error = -1; error = -1;
goto cleanup; goto cleanup;
...@@ -843,9 +844,13 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs) ...@@ -843,9 +844,13 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs)
to_active = &specs; to_active = &specs;
} }
free_refspecs(&remote->active_refspecs); free_refspecs(&remote->passive_refspecs);
if ((error = dwim_refspecs(&remote->passive_refspecs, &remote->refspecs, &refs)) < 0)
goto on_error;
free_refspecs(&remote->active_refspecs);
error = dwim_refspecs(&remote->active_refspecs, to_active, &refs); error = dwim_refspecs(&remote->active_refspecs, to_active, &refs);
git_vector_free(&refs); git_vector_free(&refs);
free_refspecs(&specs); free_refspecs(&specs);
git_vector_free(&specs); git_vector_free(&specs);
...@@ -1218,6 +1223,9 @@ void git_remote_free(git_remote *remote) ...@@ -1218,6 +1223,9 @@ void git_remote_free(git_remote *remote)
free_refspecs(&remote->active_refspecs); free_refspecs(&remote->active_refspecs);
git_vector_free(&remote->active_refspecs); git_vector_free(&remote->active_refspecs);
free_refspecs(&remote->passive_refspecs);
git_vector_free(&remote->passive_refspecs);
git__free(remote->url); git__free(remote->url);
git__free(remote->pushurl); git__free(remote->pushurl);
git__free(remote->name); git__free(remote->name);
......
...@@ -23,6 +23,7 @@ struct git_remote { ...@@ -23,6 +23,7 @@ struct git_remote {
git_vector refs; git_vector refs;
git_vector refspecs; git_vector refspecs;
git_vector active_refspecs; git_vector active_refspecs;
git_vector passive_refspecs;
git_transport_cb transport_cb; git_transport_cb transport_cb;
void *transport_cb_payload; void *transport_cb_payload;
git_transport *transport; git_transport *transport;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment