git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 6/6] commit-graph: add repo arg to graph readers

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jul 10, 2018, 17:31 UTC
Message-ID
<20180710173147.104757-1-jonathantanmy@google.com>
In-Reply-To
<75ef9935-342a-bbda-4ce6-e5a033f273a9@gmail.com>
Show 12 quoted lines
> > -	if (!core_commit_graph)
> > +	if (repo_config_get_bool(r, "core.commitgraph", &config_value) ||
> > +	    !config_value)
> > +		/*
> > +		 * This repository is not configured to use commit graphs, so
> > +		 * do not load one. (But report commit_graph_attempted anyway
> > +		 * so that commit graph loading is not attempted again for this
> > +		 * repository.)
> > +		 */
> 
> I reacted first to complain about this extra config lookup, but it is 
> only run once per repository, so that should be fine.

Thanks for checking. It is indeed run at most once per repository, and only if a commit graph is requested - the same as the current code.

> The tests below form a decently-large patch on their own. Perhaps split 
> them out so it is easier to know that we have some interesting things to 
> check here.

The patch is 168+ 42-, which doesn't seem that large to me, but I'll do this if others think that it is large too.

> It's worth spending some extra time looking at this test pattern as I 
> believe we will want to follow it with other arbitrary repository changes.

I agree - let me know if you notice anything you think should be changed.

Show 17 quoted lines
> > +static void test_get_commit_tree_in_graph(const char *gitdir,
> > +					  const char *worktree,
> > +					  const struct object_id *commit_oid)
> > +{
> > +	struct repository r;
> > +	struct commit *c;
> > +	struct tree *tree;
> > +
> > +	/*
> > +	 * Create a commit independent of any repository.
> > +	 */
> > +	c = lookup_commit(commit_oid);
> 
> Would this be more accurate to say we are creating a commit object 
> stored in the object cache of the_repository? How would you expect this 
> to work if/when lookup_commit() takes an arbitrary repository? You want 
> to provide &r, right (after initializing)?
Yes, you're right - Stefan too mentioned that this will need to be moved
below lookup_commit(). I'm not sure what the best way is to handle this
- maybe move this, and add a "needswork" stating that we need to pass r
to lookup_commit once it supports taking in a repository argument, as an
aid to the person who performs the merge. I'll do that if a reroll is
needed.
> Also, this will conflict with sb/object-store-lookup, won't it? I'm 
> guessing this is why you didn't touch the "git commit-graph 
> [write|verify]"code paths.

It will conflict because of the change to lookup_commit(), but the only new code I'm writing is in t/helper/test-repository.c, so hopefully the merge won't be too tedious. The main reason why I didn't touch the writing/verifying part is to reduce the size of this patch set, and because that change is not needed to update parse_commit() and others.

> > +
> > +	repo_init(&r, gitdir, worktree);
> 
> I think you want to move the lookup_commit() to after this.
Yes, that's right.
Show 7 quoted lines
> > +int cmd__repository(int argc, const char **argv)
> > +{
> > +	if (argc < 2)
> > +		die("must have at least 2 arguments");
> 
> I think this "test-tool repository <verb>" pattern is a good way to get 
> some testing here.
Thanks.
Previous: Derrick StoleeNext: Derrick Stolee
Message 28 of 49 in “Object store refactoring: commit graph”
  1. 0/5 Object store refactoring: commit graphJonathan Tan, Jun 21, 2018
  2. 1/5 object-store: add missing includeJonathan Tan, Jun 21, 2018
  3. 2/5 commit-graph: add missing forward declarationJonathan Tan, Jun 21, 2018
  4. Stefan BellerJun 21, 2018
  5. Jonathan TanJun 21, 2018
  6. Derrick StoleeJun 22, 2018
  7. 3/5 commit-graph: add free_commit_graphJonathan Tan, Jun 21, 2018
  8. 4/5 commit-graph: store graph in struct object_storeJonathan Tan, Jun 21, 2018
  9. Junio C HamanoJun 25, 2018
  10. Jonathan TanJun 25, 2018
  11. Junio C HamanoJun 26, 2018
  12. 5/5 commit-graph: add repo arg to graph readersJonathan Tan, Jun 21, 2018
  13. Stefan BellerJun 21, 2018
  14. Jonathan TanJun 21, 2018
  15. Derrick StoleeJun 22, 2018
  16. Derrick StoleeJun 22, 2018
  17. Jonathan TanJun 22, 2018
  18. 0/6 Object store refactoring: commit graphJonathan Tan, Jul 9, 2018
  19. 1/6 commit-graph: refactor preparing commit graphJonathan Tan, Jul 9, 2018
  20. Stefan BellerJul 9, 2018
  21. Derrick StoleeJul 10, 2018
  22. 2/6 object-store: add missing includeJonathan Tan, Jul 9, 2018
  23. 3/6 commit-graph: add missing forward declarationJonathan Tan, Jul 9, 2018
  24. 4/6 commit-graph: add free_commit_graphJonathan Tan, Jul 9, 2018
  25. 5/6 commit-graph: store graph in struct object_storeJonathan Tan, Jul 9, 2018
  26. 6/6 commit-graph: add repo arg to graph readersJonathan Tan, Jul 9, 2018
  27. Derrick StoleeJul 10, 2018
  28. Jonathan TanJul 10, 2018
  29. Derrick StoleeJul 11, 2018
  30. Jonathan TanJul 11, 2018
  31. SZEDER GáborJul 10, 2018
  32. Johannes SchindelinJul 10, 2018
  33. Jonathan TanJul 10, 2018
  34. Stefan BellerJul 9, 2018
  35. Junio C HamanoJul 9, 2018
  36. Derrick StoleeJul 10, 2018
  37. Derrick StoleeJul 10, 2018
  38. 0/6 Object store refactoring: commit graphJonathan Tan, Jul 11, 2018
  39. 1/6 commit-graph: refactor preparing commit graphJonathan Tan, Jul 11, 2018
  40. 2/6 object-store: add missing includeJonathan Tan, Jul 11, 2018
  41. 3/6 commit-graph: add missing forward declarationJonathan Tan, Jul 11, 2018
  42. 4/6 commit-graph: add free_commit_graphJonathan Tan, Jul 11, 2018
  43. 5/6 commit-graph: store graph in struct object_storeJonathan Tan, Jul 11, 2018
  44. 6/6 commit-graph: add repo arg to graph readersJonathan Tan, Jul 11, 2018
  45. t5318: avoid unnecessary command substitutionsSZEDER Gábor, Aug 13, 2018
  46. Derrick StoleeAug 13, 2018
  47. Junio C HamanoAug 13, 2018
  48. Junio C HamanoJul 12, 2018
  49. Derrick StoleeJul 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.