-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from JakeGinnivan/pr/GitFlowWithDevelop
Pr/git flow with develop
- Loading branch information
Showing
12 changed files
with
139 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...sionCore/VersionCalculation/BaseVersionCalculators/TrackMergeTargetBaseVersionStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace GitVersion.VersionCalculation.BaseVersionCalculators | ||
{ | ||
using System; | ||
using System.Linq; | ||
using LibGit2Sharp; | ||
|
||
public class TrackMergeTargetBaseVersionStrategy : HighestTagBaseVersionStrategy | ||
{ | ||
protected override bool IsValidTag(GitVersionContext context, string branchName, Tag tag, Commit commit) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(branchName)) | ||
{ | ||
if (context.Configuration.TrackMergeTarget) | ||
{ | ||
return IsDirectMergeFromCommit(tag, commit); | ||
} | ||
} | ||
|
||
return base.IsValidTag(context, branchName, tag, commit); | ||
} | ||
|
||
static bool IsDirectMergeFromCommit(Tag tag, Commit commit) | ||
{ | ||
var targetCommit = tag.Target as Commit; | ||
if (targetCommit != null) | ||
{ | ||
var parents = targetCommit.Parents; | ||
if (parents != null) | ||
{ | ||
return parents | ||
.Where(parent => parent != null) | ||
.Any(parent => string.Equals(parent.Id.Sha, commit.Id.Sha, StringComparison.OrdinalIgnoreCase)); | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters