diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index e0635dd3..514a0d59 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -38,7 +38,7 @@ namespace SourceGit.Models { get; set; - } = false; + } = true; public bool PushAllTags { diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index dd156445..6e9ff911 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -403,7 +403,7 @@ Prune worktree information in `$GIT_DIR/worktrees` Pull Branch: - Fetch all branches on pull + Fetch all branches Into: Local Changes: Discard diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index ab8f79f7..9e1794a9 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -406,6 +406,7 @@ 清理在`$GIT_DIR/worktrees`中的无效工作树信息 拉回(pull) 拉取分支 : + 拉取远程中的所有分支变更 本地分支 : 未提交更改 : 丢弃更改 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index ac1acfee..ee620cba 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -406,6 +406,7 @@ 清理在`$GIT_DIR/worktrees`中的無效工作樹資訊 拉回(pull) 拉取分支 : + 拉取遠端中的所有分支變更 本地分支 : 未提交更改 : 丟棄更改 diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 6c851458..bb969b47 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -59,7 +59,7 @@ namespace SourceGit.ViewModels set => _repo.Settings.PreferRebaseInsteadOfMerge = value; } - public bool FetchAllBranchesOnPull + public bool FetchAllBranches { get => _repo.Settings.FetchAllBranchesOnPull; set => _repo.Settings.FetchAllBranchesOnPull = value; @@ -157,14 +157,32 @@ namespace SourceGit.ViewModels } } - if (FetchAllBranchesOnPull) + var rs = false; + if (FetchAllBranches) { SetProgressDescription($"Fetching remote: {_selectedRemote.Name}..."); - new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec(); + rs = new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec(); + if (!rs) + return false; + + // Use merge/rebase instead of pull as fetch is done manually. + if (UseRebase) + { + SetProgressDescription($"Rebase {_current.Name} on {_selectedBranch.FriendlyName} ..."); + rs = new Commands.Rebase(_repo.FullPath, _selectedBranch.FriendlyName, false).Exec(); + } + else + { + SetProgressDescription($"Merge {_selectedBranch.FriendlyName} into {_current.Name} ..."); + rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", SetProgressDescription).Exec(); + } + } + else + { + SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}..."); + rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec(); } - SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}..."); - var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec(); if (rs && needPopStash) { SetProgressDescription("Re-apply local changes..."); diff --git a/src/Views/Pull.axaml b/src/Views/Pull.axaml index ff9b9c5b..728f929f 100644 --- a/src/Views/Pull.axaml +++ b/src/Views/Pull.axaml @@ -83,18 +83,18 @@ Margin="8,0,0,0" IsChecked="{Binding PreAction, Mode=TwoWay, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static m:DealWithLocalChanges.Discard}}"/> - + + Content="{DynamicResource Text.Pull.FetchAllBranches}" + IsChecked="{Binding FetchAllBranches, Mode=TwoWay}"/> - + + Content="{DynamicResource Text.Pull.UseRebase}" + IsChecked="{Binding UseRebase, Mode=TwoWay}"/>