On 4/17/2018 2:10 PM, Derrick Stolee wrote:
The commit-graph feature is not useful to end users until the commit-graph file is maintained automatically by Git during normal upkeep operations. One natural place to trigger this write is during 'git gc'. Before automatically generating a commit-graph, we need to be able to verify the contents of a commit-graph file. Integrate commit-graph checks into 'fsck' that check the commit-graph contents against commits in the object database. Things to think about: * Are these the right integration points? * gc.commitGraph defaults to true right now for the purpose of testing, but may not be required to start. The goal is to have this default to true eventually, but we may want to delay that until the feature is stable. * I implement a "--reachable" option to 'git commit-graph write' that iterates over all refs. This does the same as git show-ref -s | git commit-graph write --stdin-commits but I don't know how to pipe two child processes together inside of Git. Perhaps this is a better solution, anyway. What other things should I be considering in this case? I'm unfamiliar with the inner-workings of 'fsck' and 'gc', so this is a new space for me. This RFC is based on v3 of ds/generation-numbers, and the first commit is a fixup! based on a bug in that version that I caught while prepping this series. Thanks, -Stolee Derrick Stolee (12): fixup! commit-graph: always load commit-graph information commit-graph: add 'check' subcommand commit-graph: check file header information commit-graph: parse commit from chosen graph commit-graph: check fanout and lookup table commit: force commit to parse from object database commit-graph: load a root tree from specific graph commit-graph: verify commit contents against odb fsck: check commit-graph commit-graph: add '--reachable' option gc: automatically write commit-graph files commit-graph: update design document Documentation/git-commit-graph.txt | 15 +- Documentation/git-gc.txt | 4 + Documentation/technical/commit-graph.txt | 9 -- builtin/commit-graph.c | 79 +++++++++- builtin/fsck.c | 13 ++ builtin/gc.c | 8 + commit-graph.c | 178 ++++++++++++++++++++++- commit-graph.h | 2 + commit.c | 14 +- commit.h | 1 + t/t5318-commit-graph.sh | 15 ++ 11 files changed, 311 insertions(+), 27 deletions(-)
This RFC is also available as a GitHub pull request [1] [1] https://github.com/derrickstolee/git/pull/6