Git fork

Merge branch 'ps/commit-graph-less-paranoid'

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
··· 1005 1005 uint32_t pos; 1006 1006 1007 1007 if (commit_graph_paranoia == -1) 1008 - commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1); 1008 + commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0); 1009 1009 1010 1010 if (!prepare_commit_graph(repo)) 1011 1011 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
··· 911 911 912 912 # Verify that it is possible to read the commit from the 913 913 # commit graph when not being paranoid, ... 914 - GIT_COMMIT_GRAPH_PARANOIA=false git rev-list B && 914 + git rev-list B && 915 915 # ... but parsing the commit when double checking that 916 916 # it actually exists in the object database should fail. 917 - test_must_fail git rev-list -1 B 917 + test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B 918 918 ) 919 919 ' 920 920 ··· 938 938 939 939 # Again, we should be able to parse the commit when not 940 940 # being paranoid about commit graph staleness... 941 - GIT_COMMIT_GRAPH_PARANOIA=false git rev-parse HEAD~2 && 941 + git rev-parse HEAD~2 && 942 942 # ... but fail when we are paranoid. 943 - test_must_fail git rev-parse HEAD~2 2>error && 943 + test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error && 944 944 grep "error: commit $oid exists in commit-graph but not in the object database" error 945 945 ) 946 946 '
+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