Skip to content

Commit 728d003

Browse files
committed
code_review: PR #589
* do not using namespace `SourceGit.*` * should use branch instead of repository
1 parent 1855b43 commit 728d003

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Models/CommitTemplate.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Text.RegularExpressions;
55

66
using CommunityToolkit.Mvvm.ComponentModel;
7-
using SourceGit.ViewModels;
87

98
namespace SourceGit.Models
109
{
@@ -25,11 +24,11 @@ public string Content
2524
set => SetProperty(ref _content, value);
2625
}
2726

28-
public string Apply(Repository repo, List<Change> changes)
27+
public string Apply(Branch branch, List<Change> changes)
2928
{
3029
var content = _content
3130
.Replace("${files_num}", $"{changes.Count}")
32-
.Replace("${branch_name}", repo.CurrentBranch.Name);
31+
.Replace("${branch_name}", branch.Name);
3332

3433
var matches = REG_COMMIT_TEMPLATE_FILES().Matches(content);
3534
if (matches.Count == 0)

src/ViewModels/WorkingCopy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ public ContextMenu CreateContextMenuForCommitMessages()
11571157
item.Icon = App.CreateMenuIcon("Icons.Code");
11581158
item.Click += (_, e) =>
11591159
{
1160-
CommitMessage = template.Apply(_repo, _staged);
1160+
CommitMessage = template.Apply(_repo.CurrentBranch, _staged);
11611161
e.Handled = true;
11621162
};
11631163
menu.Items.Add(item);

0 commit comments

Comments
 (0)