Use promisor_remote_get_direct() and has_promisor_remote()
Instead of using the repository_format_partial_clone global and fetch_objects() directly, let's use has_promisor_remote() and promisor_remote_get_direct(). This way all the configured promisor remotes will be taken into account, not only the one specified by extensions.partialClone. Also when cloning or fetching using a partial clone filter, remote.origin.promisor will be set to "true" instead of setting extensions.partialClone to "origin". This makes it possible to use many promisor remote just by fetching from them. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
faf2abf496
commit
b14ed5adaf
15
sha1-file.c
15
sha1-file.c
@ -30,8 +30,8 @@
|
||||
#include "mergesort.h"
|
||||
#include "quote.h"
|
||||
#include "packfile.h"
|
||||
#include "fetch-object.h"
|
||||
#include "object-store.h"
|
||||
#include "promisor-remote.h"
|
||||
|
||||
/* The maximum size for an object header. */
|
||||
#define MAX_HEADER_LEN 32
|
||||
@ -1377,16 +1377,17 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
|
||||
}
|
||||
|
||||
/* Check if it is a missing object */
|
||||
if (fetch_if_missing && repository_format_partial_clone &&
|
||||
if (fetch_if_missing && has_promisor_remote() &&
|
||||
!already_retried && r == the_repository &&
|
||||
!(flags & OBJECT_INFO_SKIP_FETCH_OBJECT)) {
|
||||
/*
|
||||
* TODO Investigate checking fetch_object() return
|
||||
* TODO value and stopping on error here.
|
||||
* TODO Pass a repository struct through fetch_object,
|
||||
* such that arbitrary repositories work.
|
||||
* TODO Investigate checking promisor_remote_get_direct()
|
||||
* TODO return value and stopping on error here.
|
||||
* TODO Pass a repository struct through
|
||||
* promisor_remote_get_direct(), such that arbitrary
|
||||
* repositories work.
|
||||
*/
|
||||
fetch_objects(repository_format_partial_clone, real, 1);
|
||||
promisor_remote_get_direct(r, real, 1);
|
||||
already_retried = 1;
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user