Skip to content

Commit

Permalink
Merge pull request #914 from rnc/BR3
Browse files Browse the repository at this point in the history
Fix GitTest missing tag
  • Loading branch information
stuartwdouglas authored Nov 9, 2023
2 parents de5ce77 + 31a0b1d commit 98b313a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.transport.TagOpt;
import org.eclipse.jgit.transport.URIish;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -56,7 +57,12 @@ public void testPush()
.getParent().getParent();
FileUtils.copyDirectory(new File(repoRoot.toFile(), ".git"), new File(initialRepo.toFile(), ".git"));
if (initialRepository.tagList().call().stream().noneMatch(r -> r.getName().equals("refs/tags/0.1"))) {
initialRepository.fetch().setTagOpt(TagOpt.FETCH_TAGS).call();
// Don't have the tag and cannot guarantee a fork will have it so fetch from primary repository.
initialRepository.remoteAdd()
.setUri(new URIish("https://github.com/redhat-appstudio/jvm-build-service.git")).setName("upstream")
.call();
initialRepository.fetch().setRefSpecs("refs/tags/0.1:refs/tags/0.1").setTagOpt(TagOpt.NO_TAGS)
.setRemote("upstream").call();
}

Git test = new Git() {
Expand Down

0 comments on commit 98b313a

Please sign in to comment.