Merge branch 'cc/multi-promisor'

Teach the lazy clone machinery that there can be more than one
promisor remote and consult them in order when downloading missing
objects on demand.

* cc/multi-promisor:
  Move core_partial_clone_filter_default to promisor-remote.c
  Move repository_format_partial_clone to promisor-remote.c
  Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}
  remote: add promisor and partial clone config to the doc
  partial-clone: add multiple remotes in the doc
  t0410: test fetching from many promisor remotes
  builtin/fetch: remove unique promisor remote limitation
  promisor-remote: parse remote.*.partialclonefilter
  Use promisor_remote_get_direct() and has_promisor_remote()
  promisor-remote: use repository_format_partial_clone
  promisor-remote: add promisor_remote_reinit()
  promisor-remote: implement promisor_remote_get_direct()
  Add initial support for many promisor remotes
  fetch-object: make functions return an error code
  t0410: remove pipes after git commands
This commit is contained in:
Junio C Hamano
2019-09-18 11:50:09 -07:00
27 changed files with 524 additions and 173 deletions

9
diff.c
View File

@ -25,7 +25,7 @@
#include "packfile.h"
#include "parse-options.h"
#include "help.h"
#include "fetch-object.h"
#include "promisor-remote.h"
#ifdef NO_FAST_WORKING_DIRECTORY
#define FAST_WORKING_DIRECTORY 0
@ -6520,8 +6520,7 @@ static void add_if_missing(struct repository *r,
void diffcore_std(struct diff_options *options)
{
if (options->repo == the_repository &&
repository_format_partial_clone) {
if (options->repo == the_repository && has_promisor_remote()) {
/*
* Prefetch the diff pairs that are about to be flushed.
*/
@ -6538,8 +6537,8 @@ void diffcore_std(struct diff_options *options)
/*
* NEEDSWORK: Consider deduplicating the OIDs sent.
*/
fetch_objects(repository_format_partial_clone,
to_fetch.oid, to_fetch.nr);
promisor_remote_get_direct(options->repo,
to_fetch.oid, to_fetch.nr);
oid_array_clear(&to_fetch);
}