Re: [PATCH 5/5] commit-graph: add repo arg to graph readers
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 21, 2018, 22:41 UTC
- Message-ID
- <CAGZ79kYYD48PQiSqjqHkrqX9stKbGmEAHc1ArsuUgSHhwv5=Vw@mail.gmail.com>
- In-Reply-To
- <da1a513f2508602e0736b6fbe142b2445948bd5c.1529616356.git.jonathantanmy@google.com>
Show 10 quoted lines
> diff --git a/commit.c b/commit.c
> index 0030e79940..38c12b002f 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -317,7 +317,7 @@ struct tree *get_commit_tree(const struct commit *commit)
> if (commit->graph_pos == COMMIT_NOT_FROM_GRAPH)
> BUG("commit has NULL tree, but was not loaded from commit-graph");
>
> - return get_commit_tree_in_graph(commit);
> + return get_commit_tree_in_graph(the_repository, commit);Here..
Show 9 quoted lines
> } > > struct object_id *get_commit_tree_oid(const struct commit *commit) > @@ -413,7 +413,7 @@ int parse_commit_gently(struct commit *item, int quiet_on_missing) > return -1; > if (item->object.parsed) > return 0; > - if (parse_commit_in_graph(item)) > + if (parse_commit_in_graph(the_repository, item))
and here
Show 11 quoted lines
> +static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
> + const struct object_id *commit_oid)
> +{
> + struct repository r;
> + struct commit *c;
> + struct commit_list *parent;
> +
> + /*
> + * Create a commit independent of any repository.
> + */
> + c = lookup_commit(commit_oid);.. and this one are unfortunate as the rest of the object store series has not progressed as far as needed.
The lookup_commit series is out there already, and that will teach lookup_commit a repository argument. When rerolling that series I need to switch the order of repo_init and lookup_commit such that we can pass the repo to the lookup.
> +test_expect_success 'setup non-the_repository tests' '
> +test_expect_success 'parse_commit_in_graph works for non-the_repository' '
> +test_expect_success 'get_commit_tree_in_graph works for non-the_repository' '
This is really nice!
Overall this series looks good to me, Stefan