Skip to content

Commit

Permalink
Revert "Bump jgit.version from 7.0.0.202409031743-r to 7.1.0.20241126…
Browse files Browse the repository at this point in the history
…1347-r (…" (#1223)

This reverts commit 4895aee.
  • Loading branch information
MarkEWaite authored Dec 4, 2024
1 parent ff37e60 commit 1ae39db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<jgit.version>7.1.0.202411261347-r</jgit.version>
<jgit.version>7.0.0.202409031743-r</jgit.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotless.check.skip>false</spotless.check.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import hudson.model.TaskListener;
import hudson.plugins.git.GitObject;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
Expand Down Expand Up @@ -80,17 +81,21 @@ private void createFile(final String path, final String content) throws Exceptio
}
}

private void packRefs() throws Exception {
try (org.eclipse.jgit.api.Git jgit = new org.eclipse.jgit.api.Git(new FileRepository(repoRootGitDir))) {
jgit.packRefs().setAll(true).call();
private void packRefs() throws IOException {
try (FileRepository repo = new FileRepository(repoRootGitDir)) {
org.eclipse.jgit.internal.storage.file.GC gc;
gc = new org.eclipse.jgit.internal.storage.file.GC(repo);
gc.packRefs();
}
}

// No flavor of GitClient has a tag(String) API, only tag(String,String).
// But sometimes we want a lightweight a.k.a. non-annotated tag.
private void lightweightTag(String tagName) throws Exception {
try (org.eclipse.jgit.api.Git jgit = new org.eclipse.jgit.api.Git(new FileRepository(repoRootGitDir))) {
jgit.tag().setName(tagName).setAnnotated(false).call();
try (FileRepository repo = new FileRepository(repoRootGitDir)) {
// Collides with implicit org.jenkinsci.plugins.gitclient.Git.
org.eclipse.jgit.api.Git jgitAPI = org.eclipse.jgit.api.Git.wrap(repo);
jgitAPI.tag().setName(tagName).setAnnotated(false).call();
}
}

Expand Down

0 comments on commit 1ae39db

Please sign in to comment.