Skip to content

Commit

Permalink
Only use the -n flag when a tag message is not defined #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobehn committed Jul 30, 2015
1 parent 6838a02 commit 87d3dde
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 13 additions & 0 deletions GitFlow.VS.Tests/GitFlowWrapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ public void FinishHotfix()
}
}

[TestMethod]
public void FinishHotfixWithTagShouldTagRepo()
{
var gf = new GitFlowWrapper(sampleRepoPath);
gf.Init(new GitFlowRepoSettings());
gf.StartHotfix("hf1");
gf.FinishHotfix("hf1", "1.2.3", false);
using (var repo = new Repository(sampleRepoPath))
{
Assert.AreEqual(1, repo.Tags.Count());
}
}

[TestMethod]
public void GitFlowInitWithInvalidMasterBranchShouldFail()
{
Expand Down
12 changes: 10 additions & 2 deletions GitFlow.VS/GitFlowWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,15 @@ public GitFlowCommandResult StartRelease(string releaseName)

public GitFlowCommandResult FinishRelease(string releaseName, string tagMessage = null, bool deleteBranch = true, bool forceDeletion=false, bool pushChanges = false)
{
string gitArguments = "release finish -n \"" + TrimBranchName(releaseName) + "\"";
string gitArguments = "release finish \"" + TrimBranchName(releaseName) + "\"";
if (!String.IsNullOrEmpty(tagMessage))
{
gitArguments += " -m + \"" + tagMessage + "\"";
}
else
{
gitArguments += " -n";
}
if (!deleteBranch)
{
gitArguments += " -k";
Expand All @@ -338,11 +342,15 @@ public GitFlowCommandResult StartHotfix(string hotfixName)

public GitFlowCommandResult FinishHotfix(string hotifxName, string tagMessage = null, bool deleteBranch = true, bool forceDeletion = false, bool pushChanges = false)
{
string gitArguments = "hotfix finish -n \"" + TrimBranchName(hotifxName) + "\"";
string gitArguments = "hotfix finish \"" + TrimBranchName(hotifxName) + "\"";
if (!String.IsNullOrEmpty(tagMessage))
{
gitArguments += " -m + \"" + tagMessage + "\"";
}
else
{
gitArguments += " -n";
}
if (!deleteBranch)
{
gitArguments += " -k";
Expand Down

0 comments on commit 87d3dde

Please sign in to comment.