mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
enhance: disable pull/stash/apply/git-flow/git-lfs buttons in bare
repository
This commit is contained in:
parent
b9b5220590
commit
a112d212dc
3 changed files with 12 additions and 6 deletions
|
@ -70,7 +70,7 @@
|
||||||
Text="{DynamicResource Text.CreateBranch.LocalChanges}"
|
Text="{DynamicResource Text.CreateBranch.LocalChanges}"
|
||||||
IsVisible="{Binding !IsBareRepository}"/>
|
IsVisible="{Binding !IsBareRepository}"/>
|
||||||
<Border Grid.Row="2" Grid.Column="1" MinHeight="32" IsVisible="{Binding !IsBareRepository}">
|
<Border Grid.Row="2" Grid.Column="1" MinHeight="32" IsVisible="{Binding !IsBareRepository}">
|
||||||
<WrapPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
<RadioButton Content="{DynamicResource Text.CreateBranch.LocalChanges.DoNothing}"
|
||||||
x:Name="RadioDoNothing"
|
x:Name="RadioDoNothing"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Fetch}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Fetch}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="Pull" HotKey="{OnPlatform Ctrl+Shift+Down, macOS=⌘+Shift+Down}">
|
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="Pull" IsVisible="{Binding !IsBare}" IsEnabled="{Binding !IsBare}" HotKey="{OnPlatform Ctrl+Shift+Down, macOS=⌘+Shift+Down}">
|
||||||
<ToolTip.Tip>
|
<ToolTip.Tip>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Text="{DynamicResource Text.Pull}"/>
|
<TextBlock Text="{DynamicResource Text.Pull}"/>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Push}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Push}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="StashAll">
|
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="StashAll" IsVisible="{Binding !IsBare}">
|
||||||
<ToolTip.Tip>
|
<ToolTip.Tip>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Text="{DynamicResource Text.Stash}"/>
|
<TextBlock Text="{DynamicResource Text.Stash}"/>
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Stashes.Add}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Stashes.Add}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Command="{Binding ApplyPatch}" ToolTip.Tip="{DynamicResource Text.Apply}">
|
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Command="{Binding ApplyPatch}" IsVisible="{Binding !IsBare}" ToolTip.Tip="{DynamicResource Text.Apply}">
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Diff}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Diff}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Branch.Add}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Branch.Add}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Margin="8,0,0,0" Click="OpenGitFlowMenu" ToolTip.Tip="{DynamicResource Text.GitFlow}">
|
<Button Classes="icon_button" Width="32" Margin="8,0,0,0" Click="OpenGitFlowMenu" IsVisible="{Binding !IsBare}" ToolTip.Tip="{DynamicResource Text.GitFlow}">
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.GitFlow}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.GitFlow}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Margin="8,0,0,0" Click="OpenGitLFSMenu" ToolTip.Tip="{DynamicResource Text.GitLFS}">
|
<Button Classes="icon_button" Width="32" Margin="8,0,0,0" Click="OpenGitLFSMenu" IsVisible="{Binding !IsBare}" ToolTip.Tip="{DynamicResource Text.GitLFS}">
|
||||||
<Path Width="14" Height="14" Data="{StaticResource Icons.LFS}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.LFS}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,12 @@ namespace SourceGit.Views
|
||||||
var launcher = this.FindAncestorOfType<Launcher>();
|
var launcher = this.FindAncestorOfType<Launcher>();
|
||||||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||||
{
|
{
|
||||||
|
if (repo.IsBare)
|
||||||
|
{
|
||||||
|
App.RaiseException(repo.FullPath, "Can't run `git pull` in bare repository!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||||
launcher.ClearKeyModifier();
|
launcher.ClearKeyModifier();
|
||||||
repo.Pull(startDirectly);
|
repo.Pull(startDirectly);
|
||||||
|
|
Loading…
Reference in a new issue