[JENKINS-73775] Replace call to removed CommitBuilder.setEncoding(String) #2578
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.
[JENKINS-73775] Replace call to removed CommitBuilder.setEncoding(String)
See JENKINS-73775
JGit 7.0.0 removed the setEncoding(String) method that had been deprecated previously. The replacement is setEncoding(Charset). The JGit documentation recommends commit.setEncoding(StandardCharsets.UTF_8)
Failure was hidden by the previous setLastModified() exception because this call happens later in the same calling sequence.
Exclude org.eclipse.jgit from transitive inclusion in the git-pipeline plugin
The org.eclipse.jgit jar file is already provided by the git client plugin. Let's not risk that a 6.9.0 copy of the library is loaded into the same Java process that is running either JGit 6.10.0 (with git client plugin 5.0.0) or JGit 7.0.0 with git client plugin 6.0.0)
Testing done
Confirmed that the steps that show the error in JENKINS-73775 are passing with a snapshot build of the plugin. Steps are:
Submitter checklist
Reviewer checklist