Re: [PATCH 1/3] commit-graph: pass a 'struct repository *' in more places
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Jun 30, 2020, 20:52 UTC
- Message-ID
- <00a3658e-323c-0719-5f26-4689e2a90374@gmail.com>
- In-Reply-To
- <4ea9933b50fe0bc2738ab0e0dc52a4f17c4a2cb4.1593536481.git.me@ttaylorr.com>
On 6/30/2020 1:17 PM, Taylor Blau wrote:
> In a future commit, some commit-graph internals will want access to > 'r->settings', but we only have the 'struct object_directory *' > corresponding to that repository.
It is good to use "struct repository *" more.
> Add an additional parameter to pass the repository around in more > places. In the next patch, we will remove the object directory (and > instead reference it with 'r->odb').
And this is a good reason why we need the repository here: we will need the settings AND odb.
Show 10 quoted lines
> diff --git a/commit-graph.h b/commit-graph.h
> index 3ba0da1e5f..03d848e168 100644
> --- a/commit-graph.h
> +++ b/commit-graph.h
> @@ -76,10 +76,12 @@ struct commit_graph {
> };
>
> struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st,
> + struct repository *r,
> struct object_directory *odb);I suppose my only nit is that the struct repository pointer is not always the first parameter. I understand that you have grouped it where the 'odb' parameter is here, so perhaps that is fine.
Feel free to ignore this nit.
Thanks, -Stolee