-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Describe the bug
The diffSource.git.compareWith configuration has no effect if the files have not been committed to git.
If this is by design, it should be clearly documented. However, it does not align with the expectation of executing git diff <ref> and saving the results to a file that the plugin points to. In particular, it makes a diff reference to HEAD completely useless after the commit.
Additionally the comment in the config explicitly specifies uncommitted files:
Compares current HEAD and all uncommited with provided branch
Desktop (please complete the following information):
- OS: Mac OS X 13.0 x86_64
- Gradle version: 7.5.1
- Diff Coverage plugin version 0.9.5
To Reproduce
- Make changes to a file that require coverage, save them but do not commit.
gradle diffCoveragewith the below configuration
diffCoverageReport {
diffSource {
git.compareWith 'refs/remotes/origin/main'
}
reports {
html = true
}
}- Observe the files in
build/reports/jacocodirectory:
- The
diff.patchfile has 0 bytes - The html report under
diffCoverage/html/index.htmlsays "No class files specified." (See also report in diffCoverage gives html report with "No class files specified." #65 for which this may have been the cause.)
Expected behavior
Changed files are found and diff.patch is not empty.
Additional context
Workaround is to configure:
diffSource {
file = 'build/tmp/git.diff'
}and then execute:
git diff refs/remotes/origin/main > build/tmp/git.diff
gradle diffCoverageMetadata
Metadata
Assignees
Labels
No labels