fix: COMMIT & PUSH should hide when there's no remotes available (#956)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-07 11:45:18 +08:00
parent 8edd955370
commit 8ed7a99923
No known key found for this signature in database
3 changed files with 11 additions and 0 deletions

View file

@ -937,6 +937,9 @@ namespace SourceGit.ViewModels
CurrentBranch = branches.Find(x => x.IsCurrent); CurrentBranch = branches.Find(x => x.IsCurrent);
LocalBranchTrees = builder.Locals; LocalBranchTrees = builder.Locals;
RemoteBranchTrees = builder.Remotes; RemoteBranchTrees = builder.Remotes;
if (_workingCopy != null)
_workingCopy.HasRemotes = remotes.Count > 0;
}); });
} }

View file

@ -26,6 +26,12 @@ namespace SourceGit.ViewModels
} }
} }
public bool HasRemotes
{
get => _hasRemotes;
set => SetProperty(ref _hasRemotes, value);
}
public bool HasUnsolvedConflicts public bool HasUnsolvedConflicts
{ {
get => _hasUnsolvedConflicts; get => _hasUnsolvedConflicts;
@ -1619,6 +1625,7 @@ namespace SourceGit.ViewModels
private bool _isUnstaging = false; private bool _isUnstaging = false;
private bool _isCommitting = false; private bool _isCommitting = false;
private bool _useAmend = false; private bool _useAmend = false;
private bool _hasRemotes = false;
private List<Models.Change> _cached = []; private List<Models.Change> _cached = [];
private List<Models.Change> _unstaged = []; private List<Models.Change> _unstaged = [];
private List<Models.Change> _staged = []; private List<Models.Change> _staged = [];

View file

@ -374,6 +374,7 @@
ToolTip.VerticalOffset="0"> ToolTip.VerticalOffset="0">
<Button.IsVisible> <Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="HasRemotes"/>
<Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/> <Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/>
<Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/> <Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/>
</MultiBinding> </MultiBinding>