feature<Cleanup>: add toolbar button to run git gc and git lfs prune

This commit is contained in:
leo 2022-02-10 14:27:46 +08:00
parent bc404de937
commit b04c94ccc1
9 changed files with 103 additions and 1 deletions

View file

@ -0,0 +1,34 @@
using System.Threading.Tasks;
namespace SourceGit.Views.Popups {
/// <summary>
/// 清理仓库
/// </summary>
public partial class Cleanup : Controls.PopupWidget {
private string repo;
public Cleanup(string repo) {
this.repo = repo;
InitializeComponent();
}
public override string GetTitle() {
return App.Text("Dashboard.Clean");
}
public override Task<bool> Start() {
UpdateProgress(GetTitle());
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
new Commands.GC(repo, UpdateProgress).Exec();
var lfs = new Commands.LFS(repo);
if (lfs.IsEnabled()) lfs.Prune(UpdateProgress);
Models.Watcher.SetEnabled(repo, true);
return true;
});
}
}
}