Re: [PATCHv2 9/9] cache.h: allow oid_object_info to handle arbitrary repositories
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Apr 24, 2018, 22:49 UTC
- Message-ID
- <20180424154911.54ab50bc2f95bc92ef88350a@google.com>
- In-Reply-To
- <20180424215910.22201-10-sbeller@google.com>
On Tue, 24 Apr 2018 14:59:09 -0700 Stefan Beller <sbeller@google.com> wrote:
> This involves also adapting oid_object_info_extended and a some > internal functions that are used to implement these. It all has to > happen in one patch, because of a single recursive chain of calls visits > all these functions.
I wrote about delta_base_cache in a reply [1] to an earlier version, which is indeed safe (as discussed), but I think that other reviewers might have questions about that too so I think it's worth noting that in the commit message. Maybe write something like:
Among the functions modified to handle arbitrary repositories, unpack_entry() is one of them. Note that it still references the globals "delta_base_cache" and "delta_base_cached", but those are safe to be referenced (the former is indexed partly by "struct packed_git *", which is repo-specific, and the latter is only used to limit the size of the former as an optimization).
[1] https://public-inbox.org/git/20180424112332.38c0d04d96689f030e96825a@google.com/
Show 5 quoted lines
> sha1_object_info_extended is also used in partial clones, which allow > fetching missing objects. As this series will not add the repository > struct to the transport code and fetch_object(), add a TODO note and > bug out if a user tries to use a partial clone in a repository other than > the_repository.
s/sha1_object/oid_object/ (in the 2nd paragraph)
Also, you sent 2 versions of PATCHv2 9/9.
Show 14 quoted lines
> @@ -1290,9 +1291,12 @@ int oid_object_info_extended_the_repository(const struct object_id *oid, struct
> if (fetch_if_missing && repository_format_partial_clone &&
> !already_retried) {
> /*
> - * TODO Investigate haveing fetch_object() return
> + * TODO Investigate having fetch_object() return
> * TODO error/success and stopping the music here.
> + * TODO Pass a repository struct through fetch_object.
> */
> + if (r != the_repository)
> + die(_("partial clones only supported in the_repository"));
> fetch_object(repository_format_partial_clone, real->hash);
> already_retried = 1;
> continue;This most likely means that a partial clone with a submodule would wrongly error out here. Instead, the "r == the_repository" check should be done in the same "if" statement as repository_format_partial_clone (and no "die"-ing occurs if it fails - just that there will be no fetching of objects).