Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-18 17:28:52 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-18 17:28:53 +0300
commit6016ee0a7130d3ad656def12d724d1525d39af9b (patch)
treebd79cfd02f73ec3044a285b7a3ea633607c4ef70 /commit-graph.c
parentd6e67222c103783616912c26c9906b8167c39ab8 (diff)
parent9281cd07f014263b5385f13b47ff8399282c7cdc (diff)
Merge branch 'tb/fsck-no-progress'
"git fsck --no-progress" still spewed noise from the commit-graph subsystem, which has been corrected. * tb/fsck-no-progress: commit-graph.c: avoid duplicated progress output during `verify` commit-graph.c: pass progress to `verify_one_commit_graph()` commit-graph.c: iteratively verify commit-graph chains commit-graph.c: extract `verify_one_commit_graph()` fsck: suppress MIDX output with `--no-progress` fsck: suppress commit-graph output with `--no-progress`
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 38185c8529..efc697e437 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2541,18 +2541,14 @@ static int commit_graph_checksum_valid(struct commit_graph *g)
return hashfile_checksum_valid(g->data, g->data_len);
}
-int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
+static int verify_one_commit_graph(struct repository *r,
+ struct commit_graph *g,
+ struct progress *progress,
+ uint64_t *seen)
{
uint32_t i, cur_fanout_pos = 0;
struct object_id prev_oid, cur_oid;
int generation_zero = 0;
- struct progress *progress = NULL;
- int local_error = 0;
-
- if (!g) {
- graph_report("no commit-graph file loaded");
- return 1;
- }
verify_commit_graph_error = verify_commit_graph_lite(g);
if (verify_commit_graph_error)
@@ -2603,17 +2599,13 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
if (verify_commit_graph_error & ~VERIFY_COMMIT_GRAPH_ERROR_HASH)
return verify_commit_graph_error;
- if (flags & COMMIT_GRAPH_WRITE_PROGRESS)
- progress = start_progress(_("Verifying commits in commit graph"),
- g->num_commits);
-
for (i = 0; i < g->num_commits; i++) {
struct commit *graph_commit, *odb_commit;
struct commit_list *graph_parents, *odb_parents;
timestamp_t max_generation = 0;
timestamp_t generation;
- display_progress(progress, i + 1);
+ display_progress(progress, ++(*seen));
oidread(&cur_oid, g->chunk_oid_lookup + g->hash_len * i);
graph_commit = lookup_commit(r, &cur_oid);
@@ -2696,12 +2688,37 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
graph_commit->date,
odb_commit->date);
}
- stop_progress(&progress);
- local_error = verify_commit_graph_error;
+ return verify_commit_graph_error;
+}
+
+int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
+{
+ struct progress *progress = NULL;
+ int local_error = 0;
+ uint64_t seen = 0;
+
+ if (!g) {
+ graph_report("no commit-graph file loaded");
+ return 1;
+ }
+
+ if (flags & COMMIT_GRAPH_WRITE_PROGRESS) {
+ uint64_t total = g->num_commits;
+ if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW))
+ total += g->num_commits_in_base;
+
+ progress = start_progress(_("Verifying commits in commit graph"),
+ total);
+ }
+
+ for (; g; g = g->base_graph) {
+ local_error |= verify_one_commit_graph(r, g, progress, &seen);
+ if (flags & COMMIT_GRAPH_VERIFY_SHALLOW)
+ break;
+ }
- if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW) && g->base_graph)
- local_error |= verify_commit_graph(r, g->base_graph, flags);
+ stop_progress(&progress);
return local_error;
}