Skip to content

Stash branch & pull requests merges are not properly parsed when branch name contains a JIRA key #321

Closed
@MacDennis76

Description

@MacDennis76

We are using Stash in combination with JIRA. The branch names can contain a JIRA issue key, for example 'TOHISP-71'. Or: 'feature/TOHISP-71'.

Consider the following commit messages and pull requests and the logic in MergeMessageParser.cs:

"Merge pull request #2 in customer/project from feature/TOHISP-71 to master"
Will not result in a version.

"Merge pull request #4 in customer/project from TOHISP-52 to master"
Will result in a major version equal to '52'. Which is not correct.

Note that the repository is called 'customer/project' and contains a forward slash. The code in MergeMessageParser.cs counts the number of forward slashes when parsing a pull request merge and this fails when the repository name contains a forward slash and the branch name contains a JIRA issue key.

The logic which parses a merged branch also fails when the branch name contains a JIRA issue key.
Commit message example: "Merge branch 'feature/TOHISP-52' into release/1.4.0"
This results in a major version equal to '52'.
The logic splits the message by using a dash and takes the second hit. But the dash can be present X-times.

Repository names in Stash can contain a forward slash. And branch names can be equal to a single JIRA issue key which contains a dash and a number.

This issue is present in commit 2c902c3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions