This changes "commit-graph verify" to ignore replace refs, as
"commit-graph write" already does.
The 3/3 is a rather simple fix, and unblocks another series that wants
to fix the GIT_TEST_COMMIT_GRAPH mode.
1-2/3 are fixes to existing commit-graph tests. I just wanted to use
the "graph_git_two_modes" helper, but it was broken, including in a
way that hid an existing failure in a years-old test.
Glen: I've tested this with your v4 series with that
"GIT_TEST_COMMIT_GRAPH=0" part of the mktag tests removed, and they
pass on top of this with GIT_TEST_COMMIT_GRAPH=true.
Ævar Arnfjörð Bjarmason (3):
commit-graph tests: fix error-hiding graph_git_two_modes() helper
commit-graph tests: fix another graph_git_two_modes() helper
commit-graph: don't consider "replace" objects with "verify"
builtin/commit-graph.c | 2 +-
t/t5318-commit-graph.sh | 5 +++--
t/t5324-split-commit-graph.sh | 20 ++++++++++++--------
3 files changed, 16 insertions(+), 11 deletions(-)
--
2.33.1.1338.g20da966911a
The graph_git_two_modes() helper added in 177722b3442 (commit:
integrate commit graph with commit parsing, 2018-04-10) didn't
&&-chain its "git commit-graph" invocations, which as can be seen with
SANITIZE=leak will happily mark tests as passing if both of these
commands die, since test_cmp() will be comparing two empty files.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
t/t5318-commit-graph.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
In 135a7123755 (commit-graph: add --split option to builtin,
2019-06-18) this function was copy/pasted to the split commit-graph
tests, as in the preceding commit we need to fix this to use
&&-chaining, so it won't be hiding errors.
Unlike its sister function in "t5318-commit-graph.sh", which we got
lucky with, this one was hiding a real test failure. A tests added in
c523035cbd8 (commit-graph: allow cross-alternate chains, 2019-06-18)
has never worked as intended. Unlike most other graph_git_behavior
uses in this file it clones the repository into a sub-directory, so
we'll need to refer to "commits/6" as "origin/commits/6".
It's not easy to simply move the "graph_git_behavior" to the test
above it, since it itself spawns a "test_expect_success". Let's
instead add support to "graph_git_behavior()" and
"graph_git_two_modes()" to pass a "-C" argument to git.
We also need to add a "test -d fork" here, because otherwise we'll
fail on e.g.:
GIT_SKIP_TESTS=t5324.13 ./t5324-split-commit-graph.sh
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
t/t5324-split-commit-graph.sh | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
Extend the code added in d6538246d3d (commit-graph: not compatible
with replace objects, 2018-08-20) which ignored replace objects in the
"write" command to ignore it in the "verify" command too.
We can just move this assignment to the cmd_commit_graph(), it
dispatches to "write" and "verify", and we're unlikely to ever get a
sub-command that would like to consider replace refs.
This will make tests added in eddc1f556cd (mktag tests: test
update-ref and reachable fsck, 2021-06-17) pass in combination with
the "GIT_TEST_COMMIT_GRAPH" mode added in 859fdc0c3cf (commit-graph:
define GIT_TEST_COMMIT_GRAPH, 2018-08-29), except that mode is
currently broken (but is being fixed concurrently). See the discussion
starting at [1].
1. https://lore.kernel.org/git/87wnmihswp.fsf@evledraar.gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/commit-graph.c | 2 +-
t/t5318-commit-graph.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)