Added TagOps.FETCH_TAGS to the fetch command so we get all tags.

This commit is contained in:
rlynch2
2016-11-05 16:23:21 -07:00
parent 01698dd998
commit 102dcf41cd
2 changed files with 13 additions and 4 deletions

View File

@@ -281,9 +281,10 @@ public class JGitEnvironmentRepository extends AbstractScmEnvironmentRepository
}
private FetchResult fetch(Git git, String label) {
FetchCommand fetch = git.fetch()
.setRemote("origin")
.setTagOpt(TagOpt.FETCH_TAGS);
FetchCommand fetch = git.fetch();
fetch.setRemote("origin");
fetch.setTagOpt(TagOpt.FETCH_TAGS);
setTimeout(fetch);
try {
if (hasText(getUsername())) {

View File

@@ -428,9 +428,17 @@ public class JGitEnvironmentRepositoryIntegrationTests {
environment = testData.getRepository().findOne("bar", "staging", "testTag");
fooProperty = ConfigServerTestUtils.getProperty(environment, "bar.properties", "foo");
assertEquals(fooProperty, "bar");
//now move the tag and test again
serverGit.tag().setName("testTag").setForceUpdate(true).setMessage("Testing a moved tag").call();
environment = testData.getRepository().findOne("bar", "staging", "testTag");
fooProperty = ConfigServerTestUtils.getProperty(environment, "bar.properties", "foo");
assertEquals(fooProperty, "testAfterTag");
}
@Test
@Test
public void testNewCommitID() throws Exception {
JGitConfigServerTestData testData = JGitConfigServerTestData.prepareClonedGitRepository(TestConfiguration.class);