On Tue, Jun 01, 2021 at 02:34:16PM -0700, Jonathan Tan wrote: > > Currently, the reading of config related to promisor remotes is done in > two places: once in setup.c (which sets the global variable > repository_format_partial_clone, to be read by the code in > promisor-remote.c), and once in promisor-remote.c. This means that care > must be taken to ensure that repository_format_partial_clone is set > before any code in promisor-remote.c accesses it. > > To simplify the code, move all such config reading to promisor-remote.c. > By doing this, it will be easier to see when > repository_format_partial_clone is written and, thus, to reason about > the code. This will be especially helpful in a subsequent commit, which > modifies this code. Do we reliably call promisor-remote.c:promisor_remote_config()? It's called only during promisor_remote_init(), which happens if we call something like promisor_remote_get_direct(), and I guess we call that one unconditionally (e.g. there's no "if (partial_clone) promisor_remote_get_direct();" that I saw in a brief glance) then it's OK. > @@ -1061,7 +1061,6 @@ extern int repository_format_worktree_config; > struct repository_format { > int version; > int precious_objects; > - char *partial_clone; /* value of extensions.partialclone */ I also don't see that this repository_format.partial_clone value gets checked anywhere anyways - I only see where it's set and freed in a brief grep - so this seems fine to me. I saw Taylor's comment about NULL-ness and other than that, this patch looks good to me. Reviewed-by: Emily Shaffer <emilyshaffer@xxxxxxxxxx>