Message ID | 20190312132959.11764-6-chriscool@tuxfamily.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Many promisor remotes | expand |
Christian Couder <christian.couder@gmail.com> writes: > A remote specified using the extensions.partialClone config > option should be considered a promisor remote too. > > This remote should be at the end of the promisor remote list, > so that it is used only if objects have not been found in other > remotes. That's a declaration, not a rationale, and does not answer "Why should the origin be only used as the last resort?". > Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > --- > promisor-remote.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/promisor-remote.c b/promisor-remote.c > index ea74f6d8a8..dcf6ef6521 100644 > --- a/promisor-remote.c > +++ b/promisor-remote.c > @@ -83,6 +83,17 @@ static void promisor_remote_do_init(int force) > initialized = 1; > > git_config(promisor_remote_config, NULL); > + > + if (repository_format_partial_clone) { > + struct promisor_remote *o, *previous; > + > + o = promisor_remote_look_up(repository_format_partial_clone, > + &previous); > + if (o) > + promisor_remote_move_to_tail(o, previous); > + else > + promisor_remote_new(repository_format_partial_clone); > + } > } > > static inline void promisor_remote_init(void)
On Wed, Mar 13, 2019 at 5:31 AM Junio C Hamano <gitster@pobox.com> wrote: > > Christian Couder <christian.couder@gmail.com> writes: > > > A remote specified using the extensions.partialClone config > > option should be considered a promisor remote too. > > > > This remote should be at the end of the promisor remote list, > > so that it is used only if objects have not been found in other > > remotes. > > That's a declaration, not a rationale, and does not answer "Why > should the origin be only used as the last resort?". I have added the following explanation: If we are using promisor remotes other than the origin, it is because these other promisor remotes are likely to be better for some reason (maybe they are closer or faster for some kind of objects) than the origin, so it's logical that we try to use them first.
Christian Couder <christian.couder@gmail.com> writes: > On Wed, Mar 13, 2019 at 5:31 AM Junio C Hamano <gitster@pobox.com> wrote: >> >> Christian Couder <christian.couder@gmail.com> writes: >> >> > A remote specified using the extensions.partialClone config >> > option should be considered a promisor remote too. >> > >> > This remote should be at the end of the promisor remote list, >> > so that it is used only if objects have not been found in other >> > remotes. >> >> That's a declaration, not a rationale, and does not answer "Why >> should the origin be only used as the last resort?". > > I have added the following explanation: > > If we are using promisor remotes other than the origin, it is > because these other promisor remotes are likely to be better > for some reason (maybe they are closer or faster for some kind > of objects) than the origin, so it's logical that we try to use > them first. Alternatively, perhaps you cloned from the origin repository which is a mirror that is not as reliable as the real thing but is faster to access when it _is_ up, and you added the true source that 'origin' mirrors from as the fallback, as it should only be used when 'origin' is down. So what you wrote is not a convincing explanation why we should treat the origin as the fallback. Writing in the end-user documentation something like "because the 'origin' remote is treated as the last resort fallback repository, after consulting other promisor remotes first and failing to obtain needed objects, you may want to use repositories with better availability listed as 'other promisor remotes' and set the worst connected remote as 'origin'" may be a valid thing to do, though. I do not like to see the tool making such a policy decision for users very much, but at least by honestly documenting, we explain what we unilaterally decide to do without having a strong justification (i.e. we could decide the other way and the decision would be equally valid, and because there is no single best choice, we arbitrarily picked one) to the users, and with that, they can adjust their use case to what the tool does to take advantage of the tool's design decision.
diff --git a/promisor-remote.c b/promisor-remote.c index ea74f6d8a8..dcf6ef6521 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -83,6 +83,17 @@ static void promisor_remote_do_init(int force) initialized = 1; git_config(promisor_remote_config, NULL); + + if (repository_format_partial_clone) { + struct promisor_remote *o, *previous; + + o = promisor_remote_look_up(repository_format_partial_clone, + &previous); + if (o) + promisor_remote_move_to_tail(o, previous); + else + promisor_remote_new(repository_format_partial_clone); + } } static inline void promisor_remote_init(void)
A remote specified using the extensions.partialClone config option should be considered a promisor remote too. This remote should be at the end of the promisor remote list, so that it is used only if objects have not been found in other remotes. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- promisor-remote.c | 11 +++++++++++ 1 file changed, 11 insertions(+)