Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last tags don't filter current branch #75

Open
maciejwajda opened this issue Mar 18, 2020 · 0 comments
Open

Last tags don't filter current branch #75

maciejwajda opened this issue Mar 18, 2020 · 0 comments

Comments

@maciejwajda
Copy link

Last tags don't filter on current branch but use all branches tags, equivalent of git tag instead of git tag --merged.
This can be fixed here net.nemerosa.versioning.git.GitInfoService#getLastTags
e.g.

    List<String> getLastTags(Project project, VersioningExtension extension, String tagPattern) {
        // Git access
        //noinspection GroovyAssignabilityCheck
        def grgit = Grgit.open(currentDir: getGitDirectory(extension, project))
        def branchCommits = grgit.log(maxCommits: 10000)*.id
        // List all tags
        return grgit.tag.list()
        // ... filters using the pattern and commits from current branch
                .findAll { (it.name =~ tagPattern).find() && branchCommits.contains(it.commit.id) }
                .sort{ a,b ->
        // ... sort by desc commit time
                    b.commit.dateTime.toEpochSecond() <=> a.commit.dateTime.toEpochSecond() ?:
        // ... (#36) commit time is not enough. We have also to consider the case where several pattern compliant tags
        // ...       are on the same commit, and we must sort them by desc version
                    TagSupport.tagOrder(tagPattern, b.name) <=> TagSupport.tagOrder(tagPattern, a.name)
        // ... gets their name only
                }*.name
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant