sourcegit/src/Models/GitFlow.cs
leo 96d4150d26 project: reorganize the structure of the project.
* remove dotnet-tool.json because the project does not rely on any dotnet tools.
* remove Directory.Build.props because the solution has only one project.
* move src/SourceGit to src. It's not needed to put all sources into a subfolder of src since there's only one project.
2024-04-02 20:00:33 +08:00

40 lines
1 KiB
C#

namespace SourceGit.Models
{
public enum GitFlowBranchType
{
None,
Feature,
Release,
Hotfix,
}
public class GitFlow
{
public string Feature { get; set; }
public string Release { get; set; }
public string Hotfix { get; set; }
public bool IsEnabled
{
get
{
return !string.IsNullOrEmpty(Feature)
&& !string.IsNullOrEmpty(Release)
&& !string.IsNullOrEmpty(Hotfix);
}
}
public GitFlowBranchType GetBranchType(string name)
{
if (!IsEnabled)
return GitFlowBranchType.None;
if (name.StartsWith(Feature))
return GitFlowBranchType.Feature;
if (name.StartsWith(Release))
return GitFlowBranchType.Release;
if (name.StartsWith(Hotfix))
return GitFlowBranchType.Hotfix;
return GitFlowBranchType.None;
}
}
}