Skip to content

Commit 095d112

Browse files
avargitster
authored andcommitted
commit-graph: don't consider "replace" objects with "verify"
Extend the code added in d653824 (commit-graph: not compatible with replace objects, 2018-08-20) which ignored replace objects in the "write" command to ignore it in the "verify" command too. We can just move this assignment to the cmd_commit_graph(), it dispatches to "write" and "verify", and we're unlikely to ever get a sub-command that would like to consider replace refs. This will make tests added in eddc1f5 (mktag tests: test update-ref and reachable fsck, 2021-06-17) pass in combination with the "GIT_TEST_COMMIT_GRAPH" mode added in 859fdc0 (commit-graph: define GIT_TEST_COMMIT_GRAPH, 2018-08-29), except that mode is currently broken (but is being fixed concurrently). See the discussion starting at [1]. 1. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a046aa3 commit 095d112

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

builtin/commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ static int graph_write(int argc, const char **argv)
267267
git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
268268
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
269269

270-
read_replace_refs = 0;
271270
odb = find_odb(the_repository, opts.obj_dir);
272271

273272
if (opts.reachable) {
@@ -328,6 +327,7 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
328327
builtin_commit_graph_usage,
329328
PARSE_OPT_STOP_AT_NON_OPTION);
330329

330+
read_replace_refs = 0;
331331
save_commit_buffer = 0;
332332

333333
if (argc > 0) {

t/t5318-commit-graph.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ test_expect_success 'replace-objects invalidates commit-graph' '
366366
git commit-graph write --reachable &&
367367
test_path_is_file .git/objects/info/commit-graph &&
368368
git replace HEAD~1 HEAD~2 &&
369+
graph_git_two_modes "commit-graph verify" &&
369370
git -c core.commitGraph=false log >expect &&
370371
git -c core.commitGraph=true log >actual &&
371372
test_cmp expect actual &&

0 commit comments

Comments
 (0)