-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathEditBranchDescription.cs
More file actions
56 lines (47 loc) · 1.45 KB
/
EditBranchDescription.cs
File metadata and controls
56 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class EditBranchDescription : Popup
{
public Models.Branch Target
{
get;
}
public string Description
{
get => _description;
set => SetProperty(ref _description, value);
}
public EditBranchDescription(Repository repo, Models.Branch target, string desc)
{
Target = target;
_repo = repo;
_originalDescription = desc;
_description = desc;
}
public override async Task<bool> Sure()
{
var trimmed = _description.Trim();
if (string.IsNullOrEmpty(trimmed))
{
if (string.IsNullOrEmpty(_originalDescription))
return true;
}
else if (trimmed.Equals(_originalDescription, StringComparison.Ordinal))
{
return true;
}
var log = _repo.CreateLog("Edit Branch Description");
Use(log);
await new Commands.Config(_repo.FullPath)
.Use(log)
.SetAsync($"branch.{Target.Name}.description", trimmed);
log.Complete();
return true;
}
private readonly Repository _repo;
private string _originalDescription = string.Empty;
private string _description = string.Empty;
}
}