Skip to content

Commit 192a2e4

Browse files
committed
feature: support --no-verify option to bypass pre-rebase hook while rebasing (#2334)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 2d3e734 commit 192a2e4

6 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎src/Commands/Rebase.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace SourceGit.Commands
44
{
55
public class Rebase : Command
66
{
7-
public Rebase(string repo, string basedOn, bool autoStash)
7+
public Rebase(string repo, string basedOn, bool autoStash, bool noVerify)
88
{
99
WorkingDirectory = repo;
1010
Context = repo;
@@ -13,6 +13,8 @@ public Rebase(string repo, string basedOn, bool autoStash)
1313
builder.Append("rebase ");
1414
if (autoStash)
1515
builder.Append("--autostash ");
16+
if (noVerify)
17+
builder.Append("--no-verify ");
1618

1719
Args = builder.Append(basedOn).ToString();
1820
}

‎src/Resources/Locales/en_US.axaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@
724724
<x:String x:Key="Text.Quit" xml:space="preserve">Quit</x:String>
725725
<x:String x:Key="Text.Rebase" xml:space="preserve">Rebase Current Branch</x:String>
726726
<x:String x:Key="Text.Rebase.AutoStash" xml:space="preserve">Stash &amp; reapply local changes</x:String>
727+
<x:String x:Key="Text.Rebase.NoVerify" xml:space="preserve">Bypass the pre-rebase hook</x:String>
727728
<x:String x:Key="Text.Rebase.On" xml:space="preserve">On:</x:String>
728729
<x:String x:Key="Text.Remote.AddTitle" xml:space="preserve">Add Remote</x:String>
729730
<x:String x:Key="Text.Remote.EditTitle" xml:space="preserve">Edit Remote</x:String>

‎src/Resources/Locales/zh_CN.axaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@
728728
<x:String x:Key="Text.Quit" xml:space="preserve">退出</x:String>
729729
<x:String x:Key="Text.Rebase" xml:space="preserve">变基(rebase)操作</x:String>
730730
<x:String x:Key="Text.Rebase.AutoStash" xml:space="preserve">自动贮藏并恢复本地变更</x:String>
731+
<x:String x:Key="Text.Rebase.NoVerify" xml:space="preserve">绕过 pre-rebase 钩子</x:String>
731732
<x:String x:Key="Text.Rebase.On" xml:space="preserve">目标提交 :</x:String>
732733
<x:String x:Key="Text.Remote.AddTitle" xml:space="preserve">添加远程仓库</x:String>
733734
<x:String x:Key="Text.Remote.EditTitle" xml:space="preserve">编辑远程仓库</x:String>

‎src/Resources/Locales/zh_TW.axaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@
728728
<x:String x:Key="Text.Quit" xml:space="preserve">結束</x:String>
729729
<x:String x:Key="Text.Rebase" xml:space="preserve">重定基底 (rebase) 操作</x:String>
730730
<x:String x:Key="Text.Rebase.AutoStash" xml:space="preserve">自動擱置變更並復原本機變更</x:String>
731+
<x:String x:Key="Text.Rebase.NoVerify" xml:space="preserve">繞過 pre-rebase 鉤子</x:String>
731732
<x:String x:Key="Text.Rebase.On" xml:space="preserve">目標提交:</x:String>
732733
<x:String x:Key="Text.Remote.AddTitle" xml:space="preserve">新增遠端存放庫</x:String>
733734
<x:String x:Key="Text.Remote.EditTitle" xml:space="preserve">編輯遠端存放庫</x:String>

‎src/ViewModels/Rebase.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public bool AutoStash
2222
set;
2323
}
2424

25+
public bool NoVerify
26+
{
27+
get;
28+
set;
29+
}
30+
2531
public Rebase(Repository repo, Models.Branch current, Models.Branch on)
2632
{
2733
_repo = repo;
@@ -49,7 +55,7 @@ public override async Task<bool> Sure()
4955
var log = _repo.CreateLog("Rebase");
5056
Use(log);
5157

52-
await new Commands.Rebase(_repo.FullPath, _revision, AutoStash)
58+
await new Commands.Rebase(_repo.FullPath, _revision, AutoStash, NoVerify)
5359
.Use(log)
5460
.ExecAsync();
5561

‎src/Views/Rebase.axaml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Text="{DynamicResource Text.Rebase}"/>
2020
</StackPanel>
2121

22-
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="130,*">
22+
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32" ColumnDefinitions="130,*">
2323
<TextBlock Grid.Row="0" Grid.Column="0"
2424
HorizontalAlignment="Right" VerticalAlignment="Center"
2525
Margin="0,0,8,0"
@@ -54,7 +54,13 @@
5454

5555
<CheckBox Grid.Row="2" Grid.Column="1"
5656
Content="{DynamicResource Text.Rebase.AutoStash}"
57-
IsChecked="{Binding AutoStash, Mode=TwoWay}"/>
57+
IsChecked="{Binding AutoStash, Mode=TwoWay}"
58+
ToolTip.Tip="--autostash"/>
59+
60+
<CheckBox Grid.Row="3" Grid.Column="1"
61+
Content="{DynamicResource Text.Rebase.NoVerify}"
62+
IsChecked="{Binding NoVerify, Mode=TwoWay}"
63+
ToolTip.Tip="--no-verify"/>
5864
</Grid>
5965
</StackPanel>
6066
</UserControl>

0 commit comments

Comments
 (0)