Skip to content

fix: use configured cache path in getDiffStats instead of hardcoded default#1712

Merged
jonesbusy merged 1 commit intojenkins-infra:mainfrom
Fikri-20:fix/get-diff-stats-cache-path
Apr 18, 2026
Merged

fix: use configured cache path in getDiffStats instead of hardcoded default#1712
jonesbusy merged 1 commit intojenkins-infra:mainfrom
Fikri-20:fix/get-diff-stats-cache-path

Conversation

@Fikri-20
Copy link
Copy Markdown
Contributor

@Fikri-20 Fikri-20 commented Apr 17, 2026

getDiffStats() was resolving the .git directory against Settings.DEFAULT_CACHE_PATH instead of config.getCachePath(). So running with --cache-path /tmp/my-cache would clone the plugin correctly there but then fail to read it back when building the PR description. One-line fix.


Testing Done

I tested it locally, and here is the before and after

Before (mainGHServiceTest):

[INFO] Running io.jenkins.tools.pluginmodernizer.core.github.GHServiceTest
[INFO] Tests run: 48, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.46 s

After (fix/get-diff-stats-cache-pathmvn clean test -pl plugin-modernizer-core):

[INFO] Tests run: 432, Failures: 0, Errors: 0, Skipped: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:55 min
[INFO] Finished at: 2026-04-17T09:11:14+02:00

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

…efault

getDiffStats() resolved the plugin's .git directory from
Settings.DEFAULT_CACHE_PATH regardless of the --cache-path option or
CACHE_DIR environment variable. Any run with a custom cache path would
fail with 'Failed to get diff stats' and report zero additions/deletions
in the modernization metadata.

Replace the hardcoded constant with config.getCachePath() so the correct
cache location is always used.
@jonesbusy jonesbusy merged commit c764721 into jenkins-infra:main Apr 18, 2026
17 checks passed
@Fikri-20 Fikri-20 deleted the fix/get-diff-stats-cache-path branch April 18, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants