зеркало из https://github.com/microsoft/git.git
Merge branch 'ab/ignore-replace-while-working-on-commit-graph'
Teach "git commit-graph" command not to allow using replace objects at all, as we do not use the commit-graph at runtime when we see object replacement. * ab/ignore-replace-while-working-on-commit-graph: commit-graph: don't consider "replace" objects with "verify" commit-graph tests: fix another graph_git_two_modes() helper commit-graph tests: fix error-hiding graph_git_two_modes() helper
This commit is contained in:
Коммит
b82299ec6f
|
@ -263,7 +263,6 @@ static int graph_write(int argc, const char **argv)
|
||||||
git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
|
git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
|
||||||
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
|
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
|
||||||
|
|
||||||
read_replace_refs = 0;
|
|
||||||
odb = find_odb(the_repository, opts.obj_dir);
|
odb = find_odb(the_repository, opts.obj_dir);
|
||||||
|
|
||||||
if (opts.reachable) {
|
if (opts.reachable) {
|
||||||
|
@ -318,6 +317,7 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix)
|
||||||
if (!argc)
|
if (!argc)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
|
read_replace_refs = 0;
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
|
|
||||||
if (!strcmp(argv[0], "verify"))
|
if (!strcmp(argv[0], "verify"))
|
||||||
|
|
|
@ -70,8 +70,8 @@ test_expect_success 'create commits and repack' '
|
||||||
'
|
'
|
||||||
|
|
||||||
graph_git_two_modes() {
|
graph_git_two_modes() {
|
||||||
git -c core.commitGraph=true $1 >output
|
git -c core.commitGraph=true $1 >output &&
|
||||||
git -c core.commitGraph=false $1 >expect
|
git -c core.commitGraph=false $1 >expect &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ test_expect_success 'replace-objects invalidates commit-graph' '
|
||||||
git commit-graph write --reachable &&
|
git commit-graph write --reachable &&
|
||||||
test_path_is_file .git/objects/info/commit-graph &&
|
test_path_is_file .git/objects/info/commit-graph &&
|
||||||
git replace HEAD~1 HEAD~2 &&
|
git replace HEAD~1 HEAD~2 &&
|
||||||
|
graph_git_two_modes "commit-graph verify" &&
|
||||||
git -c core.commitGraph=false log >expect &&
|
git -c core.commitGraph=false log >expect &&
|
||||||
git -c core.commitGraph=true log >actual &&
|
git -c core.commitGraph=true log >actual &&
|
||||||
test_cmp expect actual &&
|
test_cmp expect actual &&
|
||||||
|
|
|
@ -55,8 +55,8 @@ test_expect_success 'create commits and write commit-graph' '
|
||||||
'
|
'
|
||||||
|
|
||||||
graph_git_two_modes() {
|
graph_git_two_modes() {
|
||||||
git -c core.commitGraph=true $1 >output
|
git ${2:+ -C "$2"} -c core.commitGraph=true $1 >output &&
|
||||||
git -c core.commitGraph=false $1 >expect
|
git ${2:+ -C "$2"} -c core.commitGraph=false $1 >expect &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,12 +64,13 @@ graph_git_behavior() {
|
||||||
MSG=$1
|
MSG=$1
|
||||||
BRANCH=$2
|
BRANCH=$2
|
||||||
COMPARE=$3
|
COMPARE=$3
|
||||||
|
DIR=$4
|
||||||
test_expect_success "check normal git operations: $MSG" '
|
test_expect_success "check normal git operations: $MSG" '
|
||||||
graph_git_two_modes "log --oneline $BRANCH" &&
|
graph_git_two_modes "log --oneline $BRANCH" "$DIR" &&
|
||||||
graph_git_two_modes "log --topo-order $BRANCH" &&
|
graph_git_two_modes "log --topo-order $BRANCH" "$DIR" &&
|
||||||
graph_git_two_modes "log --graph $COMPARE..$BRANCH" &&
|
graph_git_two_modes "log --graph $COMPARE..$BRANCH" "$DIR" &&
|
||||||
graph_git_two_modes "branch -vv" &&
|
graph_git_two_modes "branch -vv" "$DIR" &&
|
||||||
graph_git_two_modes "merge-base -a $BRANCH $COMPARE"
|
graph_git_two_modes "merge-base -a $BRANCH $COMPARE" "$DIR"
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +188,10 @@ test_expect_success 'create fork and chain across alternate' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
graph_git_behavior 'alternate: commit 13 vs 6' commits/13 commits/6
|
if test -d fork
|
||||||
|
then
|
||||||
|
graph_git_behavior 'alternate: commit 13 vs 6' commits/13 origin/commits/6 "fork"
|
||||||
|
fi
|
||||||
|
|
||||||
test_expect_success 'test merge stragety constants' '
|
test_expect_success 'test merge stragety constants' '
|
||||||
git clone . merge-2 &&
|
git clone . merge-2 &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче