feature: supports parameters in commit template (#487)

- ${files_num} will be replaced with staged changes count
- ${files} will be replaced with changed file paths
- ${files:N} will be replaced with top N changes file paths and with `and {TOTAL - N} other files` at end of replaced string.
This commit is contained in:
leo 2024-09-18 20:11:34 +08:00
parent 6932ce44a9
commit 900ebd8282
No known key found for this signature in database
2 changed files with 61 additions and 7 deletions

View file

@ -780,13 +780,9 @@ namespace SourceGit.ViewModels
foreach (var change in _selectedUnstaged)
{
if (change.IsConflit)
{
hasConflicts = true;
}
else
{
hasNoneConflicts = true;
}
}
if (hasConflicts)
@ -1160,7 +1156,7 @@ namespace SourceGit.ViewModels
item.Icon = App.CreateMenuIcon("Icons.Code");
item.Click += (_, e) =>
{
CommitMessage = template.Content;
CommitMessage = template.Apply(_staged);
e.Handled = true;
};
menu.Items.Add(item);