git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: stolee@gmail.com
Cc: jonathantanmy@google.com, sbeller@google.com, git@vger.kernel.org
Subject: Re: [PATCH 5/5] commit-graph: add repo arg to graph readers
Date: Fri, 22 Jun 2018 10:21:46 -0700	[thread overview]
Message-ID: <20180622172146.1727-1-jonathantanmy@google.com> (raw)
In-Reply-To: <d7a42ecf-7261-ec14-5736-b1f9bc70ba64@gmail.com>

> On 6/21/2018 7:06 PM, Jonathan Tan wrote:
> >>> 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..
> >>
> >>>   }
> >>>
> >>>   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
> >>
> >>> +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.
> > I think the first 2 are in reverse - get_commit_tree depends on
> > get_commit_tree_in_graph and parse_commit_gently depends on
> > parse_commit_in_graph, so we need the commit-graph functions to be
> > changed first. But I agree about lookup_commit.
> >
> >> 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.
> > For future reference, Stefan is talking about this series:
> > https://public-inbox.org/git/20180613230522.55335-1-sbeller@google.com/
> >
> > Let me know if you want to reroll yours on top of mine, or vice versa. I
> > think it's clearer if mine goes in first, though, since (as you said in
> > that e-mail) parse_commit depends on this change in the commit graph.
> 
> I was about to comment that I thought 'parse_commit_in_graph' should 
> take a 'struct commit_graph' instead of 'struct repository', except for 
> these lookup_commit() calls will need the repository parameter.

Not sure what you mean by the lookup_commit() calls (if you're referring
to the part quoted above, that is test code), but
parse_commit_in_graph() has to take a struct repository (or at least a
struct object_store, perhaps) because it needs to load the commit graph
for the repository if it is not already loaded.

(An alternative, of course, is to require the user to explicitly load
the graph, but since parse_commit_in_graph() is called from
parse_commit(), I think that this implicit loading is fine.)

> Please also keep in mind that ds/commit-graph-fsck has already updated 
> this method to parse from a specific graph [1]. I'm just waiting for 
> some things like ds/generation-numbers to get into 'master' and some 
> more object-store patches to be final before I re-roll that series. I 
> mentioned this in a message that I had sent, but apparently didn't make 
> it on the list (so I re-sent it recently).
> 
> [1] 
> https://public-inbox.org/git/20180608135548.216405-4-dstolee@microsoft.com/

Thanks - I see that you introduced a new
parse_commit_in_graph_one(struct commit_graph *, struct commit *) and
made the existing parse_commit_in_graph(struct commit *item) use the
former. Combining our changes would be just adding a repository argument
to parse_commit_in_graph() and passing the graph through
parse_commit_in_graph_one() (after prepare_commit_graph() and ensuring
that the graph exists).

  parent reply	other threads:[~2018-06-22 17:21 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 21:29 [PATCH 0/5] Object store refactoring: commit graph Jonathan Tan
2018-06-21 21:29 ` [PATCH 1/5] object-store: add missing include Jonathan Tan
2018-06-21 21:29 ` [PATCH 2/5] commit-graph: add missing forward declaration Jonathan Tan
2018-06-21 21:43   ` Stefan Beller
2018-06-21 22:39     ` Jonathan Tan
2018-06-22  0:17       ` Derrick Stolee
2018-06-21 21:29 ` [PATCH 3/5] commit-graph: add free_commit_graph Jonathan Tan
2018-06-21 21:29 ` [PATCH 4/5] commit-graph: store graph in struct object_store Jonathan Tan
2018-06-25 20:57   ` Junio C Hamano
2018-06-25 22:09     ` Jonathan Tan
2018-06-26 16:40       ` Junio C Hamano
2018-06-21 21:29 ` [PATCH 5/5] commit-graph: add repo arg to graph readers Jonathan Tan
2018-06-21 22:41   ` Stefan Beller
2018-06-21 23:06     ` Jonathan Tan
2018-06-22  0:33       ` Derrick Stolee
2018-06-22  1:01         ` Derrick Stolee
2018-06-22 17:21         ` Jonathan Tan [this message]
2018-07-09 20:44 ` [PATCH v2 on ds/commit-graph-fsck 0/6] Object store refactoring: commit graph Jonathan Tan
2018-07-09 20:44   ` [PATCH v2 1/6] commit-graph: refactor preparing " Jonathan Tan
2018-07-09 21:41     ` Stefan Beller
2018-07-10  0:23       ` Derrick Stolee
2018-07-09 20:44   ` [PATCH v2 2/6] object-store: add missing include Jonathan Tan
2018-07-09 20:44   ` [PATCH v2 3/6] commit-graph: add missing forward declaration Jonathan Tan
2018-07-09 20:44   ` [PATCH v2 4/6] commit-graph: add free_commit_graph Jonathan Tan
2018-07-09 20:44   ` [PATCH v2 5/6] commit-graph: store graph in struct object_store Jonathan Tan
2018-07-09 20:44   ` [PATCH v2 6/6] commit-graph: add repo arg to graph readers Jonathan Tan
2018-07-10  0:48     ` Derrick Stolee
2018-07-10 17:31       ` Jonathan Tan
2018-07-11 19:41         ` Derrick Stolee
2018-07-11 21:08           ` Jonathan Tan
2018-07-10 11:53     ` SZEDER Gábor
2018-07-10 13:18       ` Johannes Schindelin
2018-07-10 17:23         ` Jonathan Tan
2018-07-09 21:47   ` [PATCH v2 on ds/commit-graph-fsck 0/6] Object store refactoring: commit graph Stefan Beller
2018-07-09 22:27   ` Junio C Hamano
2018-07-10  0:30     ` Derrick Stolee
2018-07-10  0:32       ` Derrick Stolee
2018-07-11 22:42 ` [PATCH v3 " Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 1/6] commit-graph: refactor preparing " Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 2/6] object-store: add missing include Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 3/6] commit-graph: add missing forward declaration Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 4/6] commit-graph: add free_commit_graph Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 5/6] commit-graph: store graph in struct object_store Jonathan Tan
2018-07-11 22:42   ` [PATCH v3 6/6] commit-graph: add repo arg to graph readers Jonathan Tan
2018-08-13  0:30     ` [PATCH] t5318: avoid unnecessary command substitutions SZEDER Gábor
2018-08-13 11:23       ` Derrick Stolee
2018-08-13 19:05       ` Junio C Hamano
2018-07-12 16:56   ` [PATCH v3 0/6] Object store refactoring: commit graph Junio C Hamano
2018-07-12 17:43   ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180622172146.1727-1-jonathantanmy@google.com \
    --to=jonathantanmy@google.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).