mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
feature: supports to enable --ignore-cr-at-eol
in diff by default
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
586ff39da1
commit
f72f1894c3
6 changed files with 32 additions and 1 deletions
|
@ -29,6 +29,8 @@ namespace SourceGit.Commands
|
|||
|
||||
if (ignoreWhitespace)
|
||||
Args = $"-c core.autocrlf=false diff --no-ext-diff --patch --ignore-all-space --unified={unified} {opt}";
|
||||
else if (Models.DiffOption.IgnoreCRAtEOL)
|
||||
Args = $"-c core.autocrlf=false diff --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}";
|
||||
else
|
||||
Args = $"-c core.autocrlf=false diff --no-ext-diff --patch --unified={unified} {opt}";
|
||||
}
|
||||
|
|
|
@ -5,6 +5,15 @@ namespace SourceGit.Models
|
|||
{
|
||||
public class DiffOption
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable `--ignore-cr-at-eol` by default?
|
||||
/// </summary>
|
||||
public static bool IgnoreCRAtEOL
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public Change WorkingCopyChange => _workingCopyChange;
|
||||
public bool IsUnstaged => _isUnstaged;
|
||||
public List<string> Revisions => _revisions;
|
||||
|
|
|
@ -497,6 +497,7 @@
|
|||
<x:String x:Key="Text.Preferences.Git.Email" xml:space="preserve">User Email</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Email.Placeholder" xml:space="preserve">Global git user email</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.EnablePruneOnFetch" xml:space="preserve">Enable --prune on fetch</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.IgnoreCRAtEOLInDiff" xml:space="preserve">Enable --ignore-cr-at-eol in diff</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Invalid" xml:space="preserve">Git (>= 2.23.0) is required by this app</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Path" xml:space="preserve">Install Path</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.SSLVerify" xml:space="preserve">Enable HTTP SSL Verify</x:String>
|
||||
|
|
|
@ -501,6 +501,7 @@
|
|||
<x:String x:Key="Text.Preferences.Git.Email" xml:space="preserve">邮箱</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Email.Placeholder" xml:space="preserve">默认GIT用户邮箱</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.EnablePruneOnFetch" xml:space="preserve">拉取更新时启用修剪(--prune)</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.IgnoreCRAtEOLInDiff" xml:space="preserve">文件对比时默认启用 --ignore-cr-at-eol 选项</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Invalid" xml:space="preserve">本软件要求GIT最低版本为2.23.0</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.Path" xml:space="preserve">安装路径</x:String>
|
||||
<x:String x:Key="Text.Preferences.Git.SSLVerify" xml:space="preserve">启用HTTP SSL验证</x:String>
|
||||
|
|
|
@ -212,6 +212,19 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _useSyntaxHighlighting, value);
|
||||
}
|
||||
|
||||
public bool IgnoreCRAtEOLInDiff
|
||||
{
|
||||
get => Models.DiffOption.IgnoreCRAtEOL;
|
||||
set
|
||||
{
|
||||
if (Models.DiffOption.IgnoreCRAtEOL != value)
|
||||
{
|
||||
Models.DiffOption.IgnoreCRAtEOL = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IgnoreWhitespaceChangesInDiff
|
||||
{
|
||||
get => _ignoreWhitespaceChangesInDiff;
|
||||
|
|
|
@ -273,7 +273,7 @@
|
|||
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.Git}"/>
|
||||
</TabItem.Header>
|
||||
|
||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
|
||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="{DynamicResource Text.Preferences.Git.Path}"
|
||||
HorizontalAlignment="Right"
|
||||
|
@ -352,6 +352,11 @@
|
|||
IsChecked="{Binding #ThisControl.EnablePruneOnFetch, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Git.IgnoreCRAtEOLInDiff}"
|
||||
IsChecked="{Binding IgnoreCRAtEOLInDiff, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="7" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Preferences.Git.SSLVerify}"
|
||||
IsChecked="{Binding #ThisControl.EnableHTTPSSLVerify, Mode=TwoWay}"/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue