Skip to content

Commit 10009ef

Browse files
committed
(#173) Fix up merge message for Stash
After actual testing on a live Stash server, it is clear that the message generated from Stash is of the format: refs/heads/pull-requests/5/merge and not as first thought: refs/heads/pull-requests/5/merge-clean Updated Acceptance Test, and also the Regex which identifies the messages, and tested on a Pull Request issued to server. All seems to work as expected.
1 parent c91f304 commit 10009ef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

AcceptanceTests/PullRequestInTeamCityTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class PullRequestInTeamCityTest
1212
const string TaggedVersion = "1.0.3";
1313

1414
[Theory]
15-
[InlineData("refs/pull-requests/5/merge-clean")]
15+
[InlineData("refs/pull-requests/5/merge")]
1616
[InlineData("refs/pull/5/merge")]
1717
public void GivenARemoteWithATagOnMaster_AndAPullRequestWithTwoCommits_AndBuildIsRunningInTeamCity_VersionIsCalculatedProperly(string pullRequestRef)
1818
{

GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace GitVersion
77

88
public static class GitHelper
99
{
10-
private const string MergeMessageRegexPattern = "refs/heads/pull(-requests)?/(?<issuenumber>[0-9]*)/merge(-clean)?";
10+
private const string MergeMessageRegexPattern = "refs/heads/pull(-requests)?/(?<issuenumber>[0-9]*)/merge";
1111

1212
public static void NormalizeGitDirectory(string gitDirectory, Authentication authentication, string branch = null)
1313
{
@@ -59,7 +59,7 @@ public static bool LooksLikeAValidPullRequestNumber(string issueNumber)
5959
public static string ExtractIssueNumber(string mergeMessage)
6060
{
6161
// Github Message: refs/heads/pull/5/merge
62-
// Stash Message: refs/heads/pull-requests/5/merge-clean
62+
// Stash Message: refs/heads/pull-requests/5/merge
6363

6464
var regex = new Regex(MergeMessageRegexPattern);
6565
var match = regex.Match(mergeMessage);

0 commit comments

Comments
 (0)