mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
enhance: ignore untracked files when calculate local changes in checkout/create branch/pull (#316)
This commit is contained in:
parent
71c2ad989b
commit
8c16ded6bd
5 changed files with 11 additions and 14 deletions
|
@ -28,11 +28,11 @@ namespace SourceGit.ViewModels
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
ProgressDescription = $"Checkout '{Branch}' ...";
|
ProgressDescription = $"Checkout '{Branch}' ...";
|
||||||
|
|
||||||
var hasLocalChanges = _repo.WorkingCopyChangesCount > 0;
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
var changes = new Commands.QueryLocalChanges(_repo.FullPath, false).Result();
|
||||||
var needPopStash = false;
|
var needPopStash = false;
|
||||||
if (hasLocalChanges)
|
if (changes.Count > 0)
|
||||||
{
|
{
|
||||||
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,11 +10,6 @@ namespace SourceGit.ViewModels
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasLocalChanges
|
|
||||||
{
|
|
||||||
get => _repo.WorkingCopyChangesCount > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AutoStash
|
public bool AutoStash
|
||||||
{
|
{
|
||||||
get => _autoStash;
|
get => _autoStash;
|
||||||
|
@ -35,8 +30,9 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
var changes = new Commands.QueryLocalChanges(_repo.FullPath, false).Result();
|
||||||
var needPopStash = false;
|
var needPopStash = false;
|
||||||
if (HasLocalChanges)
|
if (changes.Count > 0)
|
||||||
{
|
{
|
||||||
if (AutoStash)
|
if (AutoStash)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,8 +86,9 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (CheckoutAfterCreated)
|
if (CheckoutAfterCreated)
|
||||||
{
|
{
|
||||||
bool needPopStash = false;
|
var changes = new Commands.QueryLocalChanges(_repo.FullPath, false).Result();
|
||||||
if (_repo.WorkingCopyChangesCount > 0)
|
var needPopStash = false;
|
||||||
|
if (changes.Count > 0)
|
||||||
{
|
{
|
||||||
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,8 +129,9 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
var changes = new Commands.QueryLocalChanges(_repo.FullPath, false).Result();
|
||||||
var needPopStash = false;
|
var needPopStash = false;
|
||||||
if (_repo.WorkingCopyChangesCount > 0)
|
if (changes.Count > 0)
|
||||||
{
|
{
|
||||||
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,9 +26,8 @@
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Text="{DynamicResource Text.Checkout.LocalChanges}"
|
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
|
||||||
IsVisible="{Binding HasLocalChanges}"/>
|
<StackPanel Grid.Row="1" Grid.Column="1" Height="32" Orientation="Horizontal">
|
||||||
<StackPanel Grid.Row="1" Grid.Column="1" Height="32" Orientation="Horizontal" IsVisible="{Binding HasLocalChanges}">
|
|
||||||
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.StashAndReply}"
|
<RadioButton Content="{DynamicResource Text.Checkout.LocalChanges.StashAndReply}"
|
||||||
GroupName="LocalChanges"
|
GroupName="LocalChanges"
|
||||||
IsChecked="{Binding AutoStash, Mode=TwoWay}" />
|
IsChecked="{Binding AutoStash, Mode=TwoWay}" />
|
||||||
|
|
Loading…
Reference in a new issue