Git fork

Merge branch 'ps/commit-graph-less-paranoid' into maint-2.43

Earlier we stopped relying on commit-graph that (still) records
information about commits that are lost from the object store,
which has negative performance implications. The default has been
flipped to disable this pessimization.

* ps/commit-graph-less-paranoid:
commit-graph: disable GIT_COMMIT_GRAPH_PARANOIA by default

+16 -10
+3 -3
Documentation/git.txt
··· 917 917 avoid issues with stale commit-graphs that contain references to 918 918 already-deleted commits, but comes with a performance penalty. 919 919 + 920 - The default is "true", which enables the aforementioned behavior. 921 - Setting this to "false" disables the existence check. This can lead to 922 - a performance improvement at the cost of consistency. 920 + The default is "false", which disables the aforementioned behavior. 921 + Setting this to "true" enables the existence check so that stale commits 922 + will never be returned from the commit-graph at the cost of performance. 923 923 924 924 `GIT_ALLOW_PROTOCOL`:: 925 925 If set to a colon-separated list of protocols, behave as if
+1 -1
commit-graph.c
··· 1029 1029 uint32_t pos; 1030 1030 1031 1031 if (commit_graph_paranoia == -1) 1032 - commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1); 1032 + commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0); 1033 1033 1034 1034 if (!prepare_commit_graph(repo)) 1035 1035 return NULL;
+1 -1
commit.c
··· 577 577 static int commit_graph_paranoia = -1; 578 578 579 579 if (commit_graph_paranoia == -1) 580 - commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1); 580 + commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0); 581 581 582 582 if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) { 583 583 unparse_commit(r, &item->object.oid);
+4 -4
t/t5318-commit-graph.sh
··· 909 909 910 910 # Verify that it is possible to read the commit from the 911 911 # commit graph when not being paranoid, ... 912 - GIT_COMMIT_GRAPH_PARANOIA=false git rev-list B && 912 + git rev-list B && 913 913 # ... but parsing the commit when double checking that 914 914 # it actually exists in the object database should fail. 915 - test_must_fail git rev-list -1 B 915 + test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B 916 916 ) 917 917 ' 918 918 ··· 936 936 937 937 # Again, we should be able to parse the commit when not 938 938 # being paranoid about commit graph staleness... 939 - GIT_COMMIT_GRAPH_PARANOIA=false git rev-parse HEAD~2 && 939 + git rev-parse HEAD~2 && 940 940 # ... but fail when we are paranoid. 941 - test_must_fail git rev-parse HEAD~2 2>error && 941 + test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error && 942 942 grep "error: commit $oid exists in commit-graph but not in the object database" error 943 943 ) 944 944 '
+6
t/t6022-rev-list-missing.sh
··· 13 13 test_commit 3 14 14 ' 15 15 16 + # We manually corrupt the repository, which means that the commit-graph may 17 + # contain references to already-deleted objects. We thus need to enable 18 + # commit-graph paranoia to not returned these deleted commits from the graph. 19 + GIT_COMMIT_GRAPH_PARANOIA=true 20 + export GIT_COMMIT_GRAPH_PARANOIA 21 + 16 22 for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t" 17 23 do 18 24 test_expect_success "rev-list --missing=error fails with missing object $obj" '
+1 -1
t/t7700-repack.sh
··· 271 271 ls .git/objects/pack/*.pack >before-pack-dir && 272 272 273 273 test_must_fail git fsck && 274 - test_must_fail git repack --cruft -d 2>err && 274 + test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err && 275 275 grep "bad object" err && 276 276 277 277 # Before failing, the repack did not modify the