Skip to content

Commit

Permalink
Merge pull request #124 from ketan/master
Browse files Browse the repository at this point in the history
Fallback to detecting latest revision if revisions-since call fails
  • Loading branch information
ashwanthkumar authored Aug 2, 2018
2 parents 2ef6527 + 2512e90 commit 492af8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>in.ashwanthkumar</groupId>
<artifactId>gocd-github-pr-material</artifactId>
<version>1.3.4</version>
<version>1.3.5</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ GoPluginApiResponse handleLatestRevisionSince(GoPluginApiRequest goPluginApiRequ
String latestSHA = newerRevisions.get(branch);
if(StringUtils.isNotEmpty(lastKnownSHA)) {
git.resetHard(latestSHA);
List<Revision> allRevisionsSince = git.getRevisionsSince(lastKnownSHA);
List<Revision> allRevisionsSince;
try {
allRevisionsSince = git.getRevisionsSince(lastKnownSHA);
} catch (Exception e) {
allRevisionsSince = Collections.singletonList(git.getLatestRevision());
}
List<Map<String, Object>> changesSinceLastCommit = Lists.map(allRevisionsSince, new Function<Revision, Map<String, Object>>() {
@Override
public Map<String, Object> apply(Revision revision) {
Expand Down

0 comments on commit 492af8c

Please sign in to comment.