mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
enhance: only show tracking options when file is not tracked by GIT LFS
This commit is contained in:
parent
4ce3d73d61
commit
e17e4b9a53
1 changed files with 27 additions and 22 deletions
|
@ -618,32 +618,38 @@ namespace SourceGit.ViewModels
|
||||||
lfs.Header = App.Text("GitLFS");
|
lfs.Header = App.Text("GitLFS");
|
||||||
lfs.Icon = App.CreateMenuIcon("Icons.LFS");
|
lfs.Icon = App.CreateMenuIcon("Icons.LFS");
|
||||||
|
|
||||||
var filename = Path.GetFileName(change.Path);
|
var isLFSFiltered = new Commands.IsLFSFiltered(_repo.FullPath, change.Path).Result();
|
||||||
var lfsTrackThisFile = new MenuItem();
|
if (!isLFSFiltered)
|
||||||
lfsTrackThisFile.Header = App.Text("GitLFS.Track", filename);
|
|
||||||
lfsTrackThisFile.Click += async (_, e) =>
|
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Track(filename, true));
|
var filename = Path.GetFileName(change.Path);
|
||||||
if (succ)
|
var lfsTrackThisFile = new MenuItem();
|
||||||
App.SendNotification(_repo.FullPath, $"Tracking file named {filename} successfully!");
|
lfsTrackThisFile.Header = App.Text("GitLFS.Track", filename);
|
||||||
|
lfsTrackThisFile.Click += async (_, e) =>
|
||||||
e.Handled = true;
|
|
||||||
};
|
|
||||||
lfs.Items.Add(lfsTrackThisFile);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(extension))
|
|
||||||
{
|
|
||||||
var lfsTrackByExtension = new MenuItem();
|
|
||||||
lfsTrackByExtension.Header = App.Text("GitLFS.TrackByExtension", extension);
|
|
||||||
lfsTrackByExtension.Click += async (_, e) =>
|
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Track("*" + extension, false));
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Track(filename, true));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Tracking all *{extension} files successfully!");
|
App.SendNotification(_repo.FullPath, $"Tracking file named {filename} successfully!");
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfs.Items.Add(lfsTrackByExtension);
|
lfs.Items.Add(lfsTrackThisFile);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(extension))
|
||||||
|
{
|
||||||
|
var lfsTrackByExtension = new MenuItem();
|
||||||
|
lfsTrackByExtension.Header = App.Text("GitLFS.TrackByExtension", extension);
|
||||||
|
lfsTrackByExtension.Click += async (_, e) =>
|
||||||
|
{
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Track("*" + extension, false));
|
||||||
|
if (succ)
|
||||||
|
App.SendNotification(_repo.FullPath, $"Tracking all *{extension} files successfully!");
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
lfs.Items.Add(lfsTrackByExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
lfs.Items.Add(new MenuItem() { Header = "-" });
|
||||||
}
|
}
|
||||||
|
|
||||||
var lfsLock = new MenuItem();
|
var lfsLock = new MenuItem();
|
||||||
|
@ -657,7 +663,6 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfs.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
lfs.Items.Add(lfsLock);
|
lfs.Items.Add(lfsLock);
|
||||||
|
|
||||||
var lfsUnlock = new MenuItem();
|
var lfsUnlock = new MenuItem();
|
||||||
|
|
Loading…
Reference in a new issue