feature: reset non-active branch to selected commit should not depends on upstream

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 17:56:06 +08:00
parent 188408fdfc
commit 7934496cff
No known key found for this signature in database

View file

@ -1866,21 +1866,6 @@ namespace SourceGit.ViewModels
};
menu.Items.Add(fastForward);
var selectedCommit = (_histories?.DetailContext as CommitDetail)?.Commit;
if (selectedCommit != null && !selectedCommit.SHA.Equals(branch.Head, StringComparison.Ordinal))
{
var move = new MenuItem();
move.Header = App.Text("BranchCM.ResetToSelectedCommit", branch.Name, selectedCommit.SHA.Substring(0, 10));
move.Icon = App.CreateMenuIcon("Icons.Reset");
move.Click += (_, e) =>
{
if (CanCreatePopup())
ShowPopup(new ResetWithoutCheckout(this, branch, selectedCommit));
e.Handled = true;
};
menu.Items.Add(move);
}
var fetchInto = new MenuItem();
fetchInto.Header = App.Text("BranchCM.FetchInto", upstream.FriendlyName, branch.Name);
fetchInto.Icon = App.CreateMenuIcon("Icons.Fetch");
@ -1924,6 +1909,25 @@ namespace SourceGit.ViewModels
menu.Items.Add(rebase);
}
if (worktree == null)
{
var selectedCommit = (_histories?.DetailContext as CommitDetail)?.Commit;
if (selectedCommit != null && !selectedCommit.SHA.Equals(branch.Head, StringComparison.Ordinal))
{
var move = new MenuItem();
move.Header = App.Text("BranchCM.ResetToSelectedCommit", branch.Name, selectedCommit.SHA.Substring(0, 10));
move.Icon = App.CreateMenuIcon("Icons.Reset");
move.Click += (_, e) =>
{
if (CanCreatePopup())
ShowPopup(new ResetWithoutCheckout(this, branch, selectedCommit));
e.Handled = true;
};
menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(move);
}
}
var compareWithHead = new MenuItem();
compareWithHead.Header = App.Text("BranchCM.CompareWithHead");
compareWithHead.Icon = App.CreateMenuIcon("Icons.Compare");