Skip to content

Commit

Permalink
Improve tag check rule
Browse files Browse the repository at this point in the history
  • Loading branch information
rcraggs committed Nov 30, 2018
1 parent 91fbaf0 commit 9e884d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/gitruler/GitFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ boolean doesTagExist(String tag) throws IOException {
* @param tag the name of the tag
* @return True if the commit is correctly tagged.
*/
boolean isCommitTagged(RevCommit commit, String tag) throws IOException {
boolean isCommitTagged(RevCommit commit, String tag) throws IOException, GitAPIException {

Ref tagRef = repo.findRef(tag);
return tagRef != null && tagRef.getObjectId().equals(commit.toObjectId());
RevCommit revCommit = getCommitFromRefString(tag);
return revCommit != null && revCommit.getId().equals(commit.getId());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gitruler/GitInteractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private RuleResult checkTagIsOnCommitWithMessage(Rule r) {
}else{
try {
result.setPassed(gitFunctions.isCommitTagged(commit, r.getTag()));
} catch (IOException e) {
} catch (IOException | GitAPIException e) {
result = createResultFromException(e);
}
}
Expand Down

0 comments on commit 9e884d1

Please sign in to comment.