Re: [PATCH 1/6] object.c: parse commit in graph first
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Apr 3, 2018, 18:21 UTC
- Message-ID
- <20180403112136.db2aeda65afe0c09f262dfb9@google.com>
- In-Reply-To
- <20180403165143.80661-2-dstolee@microsoft.com>
On Tue, 3 Apr 2018 12:51:38 -0400 Derrick Stolee <dstolee@microsoft.com> wrote:
Show 10 quoted lines
> Most code paths load commits using lookup_commit() and then > parse_commit(). In some cases, including some branch lookups, the commit > is parsed using parse_object_buffer() which side-steps parse_commit() in > favor of parse_commit_buffer(). > > Before adding generation numbers to the commit-graph, we need to ensure > that any commit that exists in the graph is loaded from the graph, so > check parse_commit_in_graph() before calling parse_commit_buffer(). > > Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Modifying parse_object_buffer() is the most pragmatic way to accomplish this, but this also means that parse_object_buffer() now potentially reads from the local object store (instead of only relying on what's in memory and what's in the provided buffer). parse_object_buffer() is called by several callers including in builtin/fsck.c. I would feel more comfortable if the relevant [1] caller to parse_object_buffer() was modified instead of parse_object_buffer(), but I'll let others give their opinions too.
[1] The caller which, if modified, will result in the speedup to the merge-base calculations in the Windows repository you describe in your cover letter.