Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Commands/Push.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ namespace SourceGit.Commands
{
public class Push : Command
{
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool checkSubmodules, bool track, bool force)
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool checkSubmodules, bool track, bool force, string additionalFlags = "")
{
_remote = remote;

Expand All@@ -20,6 +20,8 @@ public Push(string repo, string local, string remote, string remoteBranch, bool
Args += "-u ";
if (force)
Args += "--force-with-lease ";
if (!string.IsNullOrWhiteSpace(additionalFlags))
Args += $"{additionalFlags.Trim()} ";

Args += $"{remote} {local}:{remoteBranch}";
}
Expand Down
1 change: 1 addition & 0 deletions src/Resources/Locales/en_US.axaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -654,6 +654,7 @@
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote Branch:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Set as tracking branch</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Push all tags</x:String>
<x:String x:Key="Text.Push.AdditionalFlags" xml:space="preserve">Additional flags:</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Push Tag To Remote</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Push to all remotes</x:String>
<x:String x:Key="Text.PushTag.Remote" xml:space="preserve">Remote:</x:String>
Expand Down
10 changes: 9 additions & 1 deletion src/ViewModels/Push.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -97,6 +97,12 @@ public bool ForcePush
set;
}

public string AdditionalFlags
{
get => _additionalFlags;
set => SetProperty(ref _additionalFlags, value);
}

public Push(Repository repo, Models.Branch localBranch)
{
_repo = repo;
Expand DownExpand Up@@ -204,7 +210,8 @@ public override async Task<bool> Sure()
PushAllTags,
_repo.Submodules.Count > 0 && CheckSubmodules,
_isSetTrackOptionVisible && _tracking,
ForcePush).Use(log).RunAsync();
ForcePush,
AdditionalFlags).Use(log).RunAsync();

log.Complete();
return succ;
Expand DownExpand Up@@ -263,5 +270,6 @@ private void AutoSelectBranchByRemote()
private Models.Branch _selectedRemoteBranch = null;
private bool _isSetTrackOptionVisible = false;
private bool _tracking = true;
private string _additionalFlags = string.Empty;
}
}
12 changes: 11 additions & 1 deletion src/Views/Push.axaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
Text="{DynamicResource Text.Push.Title}"/>
</StackPanel>

<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,32,32" ColumnDefinitions="130,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,32,32,32" ColumnDefinitions="130,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Expand DownExpand Up@@ -122,6 +122,16 @@
Content="{DynamicResource Text.Push.Force}"
IsChecked="{Binding ForcePush, Mode=TwoWay}"
ToolTip.Tip="--force-with-lease"/>

<TextBlock Grid.Row="7" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.Push.AdditionalFlags}"/>
<TextBox Grid.Row="7" Grid.Column="1"
Height="28" Padding="8,0"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
Text="{Binding AdditionalFlags, Mode=TwoWay}"
Watermark="--no-verify, --dry-run, etc."/>
</Grid>
</StackPanel>
</UserControl>