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
This commit is contained in:
@@ -917,9 +917,9 @@ for full details.
|
|||||||
avoid issues with stale commit-graphs that contain references to
|
avoid issues with stale commit-graphs that contain references to
|
||||||
already-deleted commits, but comes with a performance penalty.
|
already-deleted commits, but comes with a performance penalty.
|
||||||
+
|
+
|
||||||
The default is "true", which enables the aforementioned behavior.
|
The default is "false", which disables the aforementioned behavior.
|
||||||
Setting this to "false" disables the existence check. This can lead to
|
Setting this to "true" enables the existence check so that stale commits
|
||||||
a performance improvement at the cost of consistency.
|
will never be returned from the commit-graph at the cost of performance.
|
||||||
|
|
||||||
`GIT_ALLOW_PROTOCOL`::
|
`GIT_ALLOW_PROTOCOL`::
|
||||||
If set to a colon-separated list of protocols, behave as if
|
If set to a colon-separated list of protocols, behave as if
|
||||||
|
|||||||
@@ -1029,7 +1029,7 @@ struct commit *lookup_commit_in_graph(struct repository *repo, const struct obje
|
|||||||
uint32_t pos;
|
uint32_t pos;
|
||||||
|
|
||||||
if (commit_graph_paranoia == -1)
|
if (commit_graph_paranoia == -1)
|
||||||
commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
|
commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
|
||||||
|
|
||||||
if (!prepare_commit_graph(repo))
|
if (!prepare_commit_graph(repo))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
2
commit.c
2
commit.c
@@ -577,7 +577,7 @@ int repo_parse_commit_internal(struct repository *r,
|
|||||||
static int commit_graph_paranoia = -1;
|
static int commit_graph_paranoia = -1;
|
||||||
|
|
||||||
if (commit_graph_paranoia == -1)
|
if (commit_graph_paranoia == -1)
|
||||||
commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
|
commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
|
||||||
|
|
||||||
if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) {
|
if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) {
|
||||||
unparse_commit(r, &item->object.oid);
|
unparse_commit(r, &item->object.oid);
|
||||||
|
|||||||
@@ -909,10 +909,10 @@ test_expect_success 'stale commit cannot be parsed when given directly' '
|
|||||||
|
|
||||||
# Verify that it is possible to read the commit from the
|
# Verify that it is possible to read the commit from the
|
||||||
# commit graph when not being paranoid, ...
|
# commit graph when not being paranoid, ...
|
||||||
GIT_COMMIT_GRAPH_PARANOIA=false git rev-list B &&
|
git rev-list B &&
|
||||||
# ... but parsing the commit when double checking that
|
# ... but parsing the commit when double checking that
|
||||||
# it actually exists in the object database should fail.
|
# it actually exists in the object database should fail.
|
||||||
test_must_fail git rev-list -1 B
|
test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
@@ -936,9 +936,9 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' '
|
|||||||
|
|
||||||
# Again, we should be able to parse the commit when not
|
# Again, we should be able to parse the commit when not
|
||||||
# being paranoid about commit graph staleness...
|
# being paranoid about commit graph staleness...
|
||||||
GIT_COMMIT_GRAPH_PARANOIA=false git rev-parse HEAD~2 &&
|
git rev-parse HEAD~2 &&
|
||||||
# ... but fail when we are paranoid.
|
# ... but fail when we are paranoid.
|
||||||
test_must_fail git rev-parse HEAD~2 2>error &&
|
test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error &&
|
||||||
grep "error: commit $oid exists in commit-graph but not in the object database" error
|
grep "error: commit $oid exists in commit-graph but not in the object database" error
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ test_expect_success 'create repository and alternate directory' '
|
|||||||
test_commit 3
|
test_commit 3
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# We manually corrupt the repository, which means that the commit-graph may
|
||||||
|
# contain references to already-deleted objects. We thus need to enable
|
||||||
|
# commit-graph paranoia to not returned these deleted commits from the graph.
|
||||||
|
GIT_COMMIT_GRAPH_PARANOIA=true
|
||||||
|
export GIT_COMMIT_GRAPH_PARANOIA
|
||||||
|
|
||||||
for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
|
for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
|
||||||
do
|
do
|
||||||
test_expect_success "rev-list --missing=error fails with missing object $obj" '
|
test_expect_success "rev-list --missing=error fails with missing object $obj" '
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ test_expect_success 'repacking fails when missing .pack actually means missing o
|
|||||||
ls .git/objects/pack/*.pack >before-pack-dir &&
|
ls .git/objects/pack/*.pack >before-pack-dir &&
|
||||||
|
|
||||||
test_must_fail git fsck &&
|
test_must_fail git fsck &&
|
||||||
test_must_fail git repack --cruft -d 2>err &&
|
test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err &&
|
||||||
grep "bad object" err &&
|
grep "bad object" err &&
|
||||||
|
|
||||||
# Before failing, the repack did not modify the
|
# Before failing, the repack did not modify the
|
||||||
|
|||||||
Reference in New Issue
Block a user