diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-09-17 13:53:52 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-09-17 13:53:52 -0700 |
| commit | 1b7a91da71d42759dfb83fa3a17be54ad01f0132 (patch) | |
| tree | 921c80479f0f12a95114b0b32f6fdfa928f170c8 /commit-graph.c | |
| parent | Merge branch 'sb/submodule-update-in-c' (diff) | |
| parent | commit-reach: correct accidental #include of C file (diff) | |
| download | git-1b7a91da71d42759dfb83fa3a17be54ad01f0132.tar.gz git-1b7a91da71d42759dfb83fa3a17be54ad01f0132.zip | |
Merge branch 'ds/reachable'
The code for computing history reachability has been shuffled,
obtained a bunch of new tests to cover them, and then being
improved.
* ds/reachable:
commit-reach: correct accidental #include of C file
commit-reach: use can_all_from_reach
commit-reach: make can_all_from_reach... linear
commit-reach: replace ref_newer logic
test-reach: test commit_contains
test-reach: test can_all_from_reach_with_flags
test-reach: test reduce_heads
test-reach: test get_merge_bases_many
test-reach: test is_descendant_of
test-reach: test in_merge_bases
test-reach: create new test tool for ref_newer
commit-reach: move can_all_from_reach_with_flags
upload-pack: generalize commit date cutoff
upload-pack: refactor ok_to_give_up()
upload-pack: make reachable() more generic
commit-reach: move commit_contains from ref-filter
commit-reach: move ref_newer from remote.c
commit.h: remove method declarations
commit-reach: move walk methods from commit.c
Diffstat (limited to 'commit-graph.c')
| -rw-r--r-- | commit-graph.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/commit-graph.c b/commit-graph.c index 8a1bec7b8a..0cad55eec2 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -233,6 +233,24 @@ static int prepare_commit_graph(struct repository *r) return !!r->objects->commit_graph; } +int generation_numbers_enabled(struct repository *r) +{ + uint32_t first_generation; + struct commit_graph *g; + if (!prepare_commit_graph(r)) + return 0; + + g = r->objects->commit_graph; + + if (!g->num_commits) + return 0; + + first_generation = get_be32(g->chunk_commit_data + + g->hash_len + 8) >> 2; + + return !!first_generation; +} + static void close_commit_graph(void) { free_commit_graph(the_repository->objects->commit_graph); |
