Repository navigation
Conversation
A build of a source release, such as a git archive export, has no
.git, so no line can count as changed. cribro still ran test under the
JaCoCo agent, which costs about 20% of its wall time, and then printed
Diff coverage: no base ref resolved, so no line counts as changed. Pass -Pcribro.diffBase=<ref>, or set an upstream branch, or fetch origin/HEAD, origin/main, or origin/master.
once per module, advising a fetch into a repository that does not
exist. Where git is not installed, diffCoverage failed the build after
the tests passed, with "cannot run git in <dir>".
Whether the build lies in a work tree is now decided at configuration
time from the file system and the environment, with no git process:
a .git directory or file at or above the root directory, as in a clone,
a linked worktree, or a submodule, or GIT_DIR in the environment.
Outside a work tree the Gradle plugin turns the agent off on test and
disables jacocoTestReport, as -Pcribro.diffCoverageEnabled=false does,
and finalizes test with diffCoverage alone; the Maven extension attaches
no agent. Deciding at execution time was rejected: whether the agent is
enabled is an input of test, so turning it off in doFirst would cache an
uninstrumented result under the key of an instrumented run.
With GIT_DIR and no .git, git keeps running in the build's root
directory, so a relative GIT_DIR or GIT_WORK_TREE resolves as before.
User-visible:
Outside a git work tree, test runs without the JaCoCo agent, and the build prints one line, "Diff coverage: skipped, since <dir> is not in a git work tree.", at the QUIET level in Gradle and at the end of the session in Maven; no git command runs.
Outside a git work tree, changedLines writes a file with the header "not in a git work tree" and no line, so pitestDiff is skipped.
In Maven, GIT_DIR in the environment with no .git now counts as a work tree, where cribro used to report that the build was not in one.
Fixes cribro-dev#36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Skipping Cribro instrumentation also disabled a Gradle project's own JaCoCo setup. A direct pitestDiff invocation could still resolve PIT dependencies while Gradle saved the configuration cache. Leave project-owned coverage in place and keep PIT inputs out of the archive task graph. Share configuration-time Git discovery between Gradle and Maven, and cover the skip notice and stale-report cleanup with a fresh Gradle process that cannot launch Git.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A build of a source release, such as a
git archiveexport, has no changed lines to measure. Cribro used to attach JaCoCo anyway and report that it could not resolve a base. If Git was unavailable, Gradle failed withcannot run git in <dir>after the tests passed.Cribro checks for a usable Git work tree before configuring automatic diff coverage. It probes Git only when repository hints exist. Gradle tracks the selection as a configuration-cache input so that a change in repository layout can change test instrumentation before Gradle computes the task graph.
User-visible changes
Diff coverage: skipped, since <dir> is not in a git work tree.once per build. Gradle prints it at QUIET level. Maven prints it after a recorded Surefire execution and before the build summary.changedLineswrites only the headernot in a git work tree.pitestDiffskips without resolving PIT dependencies, including under the configuration cache.Verification
./gradlew --quiet build dist -PtestJavaVersion=21completed with 889 tests passed and two Windows-only tests skipped. The Gradle 8.14.3 sample also passed on JDK 11.pitestDiffalso passed with the configuration cache and an empty PIT dependency cache.Open review findings
core.worktreeto select the enclosing checkout. Git returns checkout-relative paths, while Cribro filters against the nested command directory..gitdirectory can hide a Git error for the enclosing checkout when Git cannot complete discovery.GIT_WORK_TREEoverrides in nested builds remains under review.Fixes #36