mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-26 11:51:17 +08:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SourceGit.ViewModels
|
|
{
|
|
public class LFSTrackCustomPattern : Popup
|
|
{
|
|
[Required(ErrorMessage = "LFS track pattern is required!!!")]
|
|
public string Pattern
|
|
{
|
|
get => _pattern;
|
|
set => SetProperty(ref _pattern, value, true);
|
|
}
|
|
|
|
public bool IsFilename
|
|
{
|
|
get;
|
|
set;
|
|
} = false;
|
|
|
|
public LFSTrackCustomPattern(Repository repo)
|
|
{
|
|
_repo = repo;
|
|
}
|
|
|
|
public override async Task<bool> Sure()
|
|
{
|
|
_repo.SetWatcherEnabled(false);
|
|
ProgressDescription = "Adding custom LFS tracking pattern ...";
|
|
|
|
var log = _repo.CreateLog("LFS Add Custom Pattern");
|
|
Use(log);
|
|
|
|
var succ = await new Commands.LFS(_repo.FullPath).TrackAsync(_pattern, IsFilename, log);
|
|
|
|
log.Complete();
|
|
_repo.SetWatcherEnabled(true);
|
|
return succ;
|
|
}
|
|
|
|
private readonly Repository _repo = null;
|
|
private string _pattern = string.Empty;
|
|
}
|
|
}
|