commit-graph: build graph from starting commits

Teach git-commit-graph to read commits from stdin when the
--stdin-commits flag is specified. Commits reachable from these
commits are added to the graph. This is a much faster way to construct
the graph than inspecting all packed objects, but is restricted to
known tips.

For the Linux repository, 700,000+ commits were added to the graph
file starting from 'master' in 7-9 seconds, depending on the number
of packfiles in the repo (1, 24, or 120).

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2018-04-10 08:56:07 -04:00
committed by Junio C Hamano
parent 049d51a2bb
commit 3d5df01b5e
5 changed files with 75 additions and 10 deletions

View File

@ -38,6 +38,8 @@ struct commit_graph *load_commit_graph_one(const char *graph_file);
void write_commit_graph(const char *obj_dir,
const char **pack_indexes,
int nr_packs);
int nr_packs,
const char **commit_hex,
int nr_commits);
#endif