Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
add change for parentshas (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
nireeshT authored Jun 23, 2022
1 parent 18b0b44 commit 197561f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 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 @@
<artifactId>api</artifactId>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<version>3.4.38</version>
<version>3.4.39</version>
<description>Hygieia Rest API Layer</description>
<url>https://github.com/Hygieia/api</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ protected List<String> getParentShas(Object commit) {
protected CommitType getCommitType(int parentSize, String commitMessage,
GitHubWebHookSettings gitHubWebHookSettings,
List<Pattern> commitExclusionPatterns) {
if (parentSize > 1) return CommitType.Merge;
if (parentSize >= 1) return CommitType.Merge;
if (CollectionUtils.isEmpty(gitHubWebHookSettings.getNotBuiltCommits())) return CommitType.New;

if (!CollectionUtils.isEmpty(commitExclusionPatterns)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ private void processOrphanCommits(GitHubRepo repo) {


private CommitType getCommitType(int parentSize, String commitMessage) {
if (parentSize > 1) return CommitType.Merge;
if (parentSize >= 1) return CommitType.Merge;
//if (settings.getNotBuiltCommits() == null) return CommitType.New;
if (!CollectionUtils.isEmpty(commitExclusionPatterns)) {
for (Pattern pattern : commitExclusionPatterns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,17 @@ public void getCommitTypeTest() {
notBuiltCommits.add("test2");
notBuiltCommits.stream().map(regExStr -> Pattern.compile(regExStr, Pattern.CASE_INSENSITIVE)).forEach(commitExclusionPatterns::add);

CommitType commitType = gitHubCommitV3.getCommitType(2, "commit message", new GitHubWebHookSettings(), commitExclusionPatterns);
CommitType commitType = gitHubCommitV3.getCommitType(1, "commit message", new GitHubWebHookSettings(), commitExclusionPatterns);
Assert.assertEquals(CommitType.Merge, commitType);

commitType = gitHubCommitV3.getCommitType(1, "commit message", new GitHubWebHookSettings(), commitExclusionPatterns);
commitType = gitHubCommitV3.getCommitType(0, "commit message", new GitHubWebHookSettings(), commitExclusionPatterns);
Assert.assertEquals(CommitType.New, commitType);

GitHubWebHookSettings gitHubWebHookSettings = new GitHubWebHookSettings();
List<String> notBuiltCommitsList = new ArrayList<>();
notBuiltCommitsList.add("some value");
gitHubWebHookSettings.setNotBuiltCommits(notBuiltCommitsList);
commitType = gitHubCommitV3.getCommitType(1, "test1", gitHubWebHookSettings, commitExclusionPatterns);
commitType = gitHubCommitV3.getCommitType(0, "test1", gitHubWebHookSettings, commitExclusionPatterns);
Assert.assertEquals(CommitType.NotBuilt, commitType);
}

Expand Down

0 comments on commit 197561f

Please sign in to comment.