Skip to content

Commit 8ed7a99

Browse files
committed
fix: COMMIT & PUSH should hide when there's no remotes available (#956)
Signed-off-by: leo <[email protected]>
1 parent 8edd955 commit 8ed7a99

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/ViewModels/Repository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,9 @@ public void RefreshBranches()
937937
CurrentBranch = branches.Find(x => x.IsCurrent);
938938
LocalBranchTrees = builder.Locals;
939939
RemoteBranchTrees = builder.Remotes;
940+
941+
if (_workingCopy != null)
942+
_workingCopy.HasRemotes = remotes.Count > 0;
940943
});
941944
}
942945

src/ViewModels/WorkingCopy.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ public bool IncludeUntracked
2626
}
2727
}
2828

29+
public bool HasRemotes
30+
{
31+
get => _hasRemotes;
32+
set => SetProperty(ref _hasRemotes, value);
33+
}
34+
2935
public bool HasUnsolvedConflicts
3036
{
3137
get => _hasUnsolvedConflicts;
@@ -1619,6 +1625,7 @@ private bool IsChanged(List<Models.Change> old, List<Models.Change> cur)
16191625
private bool _isUnstaging = false;
16201626
private bool _isCommitting = false;
16211627
private bool _useAmend = false;
1628+
private bool _hasRemotes = false;
16221629
private List<Models.Change> _cached = [];
16231630
private List<Models.Change> _unstaged = [];
16241631
private List<Models.Change> _staged = [];

src/Views/WorkingCopy.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@
374374
ToolTip.VerticalOffset="0">
375375
<Button.IsVisible>
376376
<MultiBinding Converter="{x:Static BoolConverters.And}">
377+
<Binding Path="HasRemotes"/>
377378
<Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/>
378379
<Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/>
379380
</MultiBinding>

0 commit comments

Comments
 (0)