зеркало из https://github.com/microsoft/git.git
commit-graph: turn on commit-graph by default
The commit-graph feature has seen a lot of activity in the past year or so since it was introduced. The feature is a critical performance enhancement for medium- to large-sized repos, and does not significantly hurt small repos. Change the defaults for core.commitGraph and gc.writeCommitGraph to true so users benefit from this feature by default. There are several places in the test suite where the environment variable GIT_TEST_COMMIT_GRAPH is disabled to avoid reading a commit-graph, if it exists. The config option overrides the environment, so swap these. Some GIT_TEST_COMMIT_GRAPH assignments remain, and those are to avoid writing a commit-graph when a new commit is created. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
b068d9a250
Коммит
31b1de6a09
|
@ -577,7 +577,7 @@ the `GIT_NOTES_REF` environment variable. See linkgit:git-notes[1].
|
|||
|
||||
core.commitGraph::
|
||||
If true, then git will read the commit-graph file (if it exists)
|
||||
to parse the graph structure of commits. Defaults to false. See
|
||||
to parse the graph structure of commits. Defaults to true. See
|
||||
linkgit:git-commit-graph[1] for more information.
|
||||
|
||||
core.useReplaceRefs::
|
||||
|
|
|
@ -63,7 +63,7 @@ gc.writeCommitGraph::
|
|||
If true, then gc will rewrite the commit-graph file when
|
||||
linkgit:git-gc[1] is run. When using `git gc --auto`
|
||||
the commit-graph will be updated if housekeeping is
|
||||
required. Default is false. See linkgit:git-commit-graph[1]
|
||||
required. Default is true. See linkgit:git-commit-graph[1]
|
||||
for details.
|
||||
|
||||
gc.logExpiry::
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "config.h"
|
||||
#include "repository.h"
|
||||
|
||||
#define UPDATE_DEFAULT_BOOL(s,v) do { if (s == -1) { s = v; } } while(0)
|
||||
|
||||
void prepare_repo_settings(struct repository *r)
|
||||
{
|
||||
int value;
|
||||
|
@ -16,6 +18,8 @@ void prepare_repo_settings(struct repository *r)
|
|||
r->settings.core_commit_graph = value;
|
||||
if (!repo_config_get_bool(r, "gc.writecommitgraph", &value))
|
||||
r->settings.gc_write_commit_graph = value;
|
||||
UPDATE_DEFAULT_BOOL(r->settings.core_commit_graph, 1);
|
||||
UPDATE_DEFAULT_BOOL(r->settings.gc_write_commit_graph, 1);
|
||||
|
||||
if (!repo_config_get_bool(r, "index.version", &value))
|
||||
r->settings.index_version = value;
|
||||
|
|
|
@ -234,7 +234,7 @@ test_expect_success 'rev-list stops traversal at missing and promised commit' '
|
|||
|
||||
git -C repo config core.repositoryformatversion 1 &&
|
||||
git -C repo config extensions.partialclone "arbitrary string" &&
|
||||
GIT_TEST_COMMIT_GRAPH=0 git -C repo rev-list --exclude-promisor-objects --objects bar >out &&
|
||||
GIT_TEST_COMMIT_GRAPH=0 git -C repo -c core.commitGraph=false rev-list --exclude-promisor-objects --objects bar >out &&
|
||||
grep $(git -C repo rev-parse bar) out &&
|
||||
! grep $FOO out
|
||||
'
|
||||
|
|
|
@ -24,11 +24,11 @@ test_expect_success 'check corruption' '
|
|||
'
|
||||
|
||||
test_expect_success 'rev-list notices corruption (1)' '
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git rev-list HEAD
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'rev-list notices corruption (2)' '
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git rev-list --objects HEAD
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --objects HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'pack-objects notices corruption' '
|
||||
|
|
|
@ -8,6 +8,7 @@ GIT_TEST_COMMIT_GRAPH=0
|
|||
test_expect_success 'setup repo' '
|
||||
git init &&
|
||||
git config core.commitGraph true &&
|
||||
git config gc.writeCommitGraph false &&
|
||||
infodir=".git/objects/info" &&
|
||||
graphdir="$infodir/commit-graphs" &&
|
||||
test_oid_init
|
||||
|
@ -332,6 +333,7 @@ test_expect_success 'split across alternate where alternate is not split' '
|
|||
git clone --no-hardlinks . alt-split &&
|
||||
(
|
||||
cd alt-split &&
|
||||
rm -f .git/objects/info/commit-graph &&
|
||||
echo "$(pwd)"/../.git/objects >.git/objects/info/alternates &&
|
||||
test_commit 18 &&
|
||||
git commit-graph write --reachable --split &&
|
||||
|
|
|
@ -42,7 +42,7 @@ test_expect_success 'corrupt second commit object' \
|
|||
'
|
||||
|
||||
test_expect_success 'rev-list should fail' '
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git rev-list --all > /dev/null
|
||||
test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git -c core.commitGraph=false rev-list --all > /dev/null
|
||||
'
|
||||
|
||||
test_expect_success 'git repack _MUST_ fail' \
|
||||
|
|
Загрузка…
Ссылка в новой задаче