From c56d0cf85ead68d68331e6d63bb7c1246346a8f4 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 18 Jun 2024 12:10:38 +0800 Subject: [PATCH] refactor: external diff merge tool - supports to use difftool/mergetool settings from git config directly (#181) --- src/Commands/MergeTool.cs | 90 ++++++++++-------- src/Models/ExternalMerger.cs | 8 +- .../ExternalToolIcons/custom_diff.png | Bin 1943 -> 0 bytes src/Resources/ExternalToolIcons/git.png | Bin 0 -> 1223 bytes src/Resources/Locales/en_US.axaml | 10 +- src/Resources/Locales/zh_CN.axaml | 10 +- src/Resources/Locales/zh_TW.axaml | 10 +- src/ViewModels/BranchCompare.cs | 14 +-- src/ViewModels/CommitDetail.cs | 14 +-- src/ViewModels/DiffContext.cs | 15 +-- src/ViewModels/Preference.cs | 14 --- src/ViewModels/RevisionCompare.cs | 14 +-- src/ViewModels/WorkingCopy.cs | 15 +-- src/Views/Preference.axaml | 37 ++----- src/Views/Preference.axaml.cs | 1 + 15 files changed, 89 insertions(+), 163 deletions(-) delete mode 100644 src/Resources/ExternalToolIcons/custom_diff.png create mode 100644 src/Resources/ExternalToolIcons/git.png diff --git a/src/Commands/MergeTool.cs b/src/Commands/MergeTool.cs index 75b88bc9..d3478d59 100644 --- a/src/Commands/MergeTool.cs +++ b/src/Commands/MergeTool.cs @@ -6,57 +6,63 @@ namespace SourceGit.Commands { public static class MergeTool { - public static bool OpenForMerge(string repo, string tool, string mergeCmd, string file) + public static bool OpenForMerge(string repo, int toolType, string toolPath, string file) { - if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(mergeCmd)) - { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(repo, "Invalid external merge tool settings!"); - }); - return false; - } - - if (!File.Exists(tool)) - { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!"); - }); - return false; - } - var cmd = new Command(); cmd.WorkingDirectory = repo; - cmd.RaiseError = false; - cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{tool}\\\" {mergeCmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit \"{file}\""; + cmd.Context = repo; + cmd.RaiseError = true; + + if (toolType == 0) + { + cmd.Args = $"mergetool \"{file}\""; + return cmd.Exec(); + } + + if (!File.Exists(toolPath)) + { + Dispatcher.UIThread.Post(() => App.RaiseException(repo, $"Can NOT found external merge tool in '{toolPath}'!")); + return false; + } + + var supported = Models.ExternalMerger.Supported.Find(x => x.Type == toolType); + if (supported == null) + { + Dispatcher.UIThread.Post(() => App.RaiseException(repo, "Invalid merge tool in preference setting!")); + return false; + } + + cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.Cmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit \"{file}\""; return cmd.Exec(); } - public static bool OpenForDiff(string repo, string tool, string diffCmd, Models.DiffOption option) + public static bool OpenForDiff(string repo, int toolType, string toolPath, Models.DiffOption option) { - if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(diffCmd)) - { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(repo, "Invalid external merge tool settings!"); - }); - return false; - } - - if (!File.Exists(tool)) - { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!"); - }); - return false; - } - var cmd = new Command(); cmd.WorkingDirectory = repo; - cmd.RaiseError = false; - cmd.Args = $"-c difftool.sourcegit.cmd=\"\\\"{tool}\\\" {diffCmd}\" difftool --tool=sourcegit --no-prompt {option}"; + cmd.Context = repo; + cmd.RaiseError = true; + + if (toolType == 0) + { + cmd.Args = $"difftool -g --no-prompt {option}"; + return cmd.Exec(); + } + + if (!File.Exists(toolPath)) + { + Dispatcher.UIThread.Invoke(() => App.RaiseException(repo, $"Can NOT found external diff tool in '{toolPath}'!")); + return false; + } + + var supported = Models.ExternalMerger.Supported.Find(x => x.Type == toolType); + if (supported == null) + { + Dispatcher.UIThread.Post(() => App.RaiseException(repo, "Invalid merge tool in preference setting!")); + return false; + } + + cmd.Args = $"-c difftool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.DiffCmd}\" difftool --tool=sourcegit --no-prompt {option}"; return cmd.Exec(); } } diff --git a/src/Models/ExternalMerger.cs b/src/Models/ExternalMerger.cs index d61ce055..3130408e 100644 --- a/src/Models/ExternalMerger.cs +++ b/src/Models/ExternalMerger.cs @@ -32,7 +32,7 @@ namespace SourceGit.Models if (OperatingSystem.IsWindows()) { Supported = new List() { - new ExternalMerger(0, "custom_diff", "Custom", "", "", ""), + new ExternalMerger(0, "git", "Use Git Settings", "", "", ""), new ExternalMerger(1, "vscode", "Visual Studio Code", "Code.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), new ExternalMerger(2, "vscode_insiders", "Visual Studio Code - Insiders", "Code - Insiders.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), new ExternalMerger(3, "vs", "Visual Studio", "vsDiffMerge.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" /m", "\"$LOCAL\" \"$REMOTE\""), @@ -46,7 +46,7 @@ namespace SourceGit.Models else if (OperatingSystem.IsMacOS()) { Supported = new List() { - new ExternalMerger(0, "custom_diff", "Custom", "", "", ""), + new ExternalMerger(0, "git", "Use Git Settings", "", "", ""), new ExternalMerger(1, "xcode", "FileMerge", "/usr/bin/opendiff", "\"$BASE\" \"$LOCAL\" \"$REMOTE\" -ancestor \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""), new ExternalMerger(2, "vscode", "Visual Studio Code", "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), new ExternalMerger(3, "vscode_insiders", "Visual Studio Code - Insiders", "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), @@ -58,7 +58,7 @@ namespace SourceGit.Models else if (OperatingSystem.IsLinux()) { Supported = new List() { - new ExternalMerger(0, "custom_diff", "Custom", "", "", ""), + new ExternalMerger(0, "git", "Use Git Settings", "", "", ""), new ExternalMerger(1, "vscode", "Visual Studio Code", "/usr/share/code/code", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), new ExternalMerger(2, "vscode_insiders", "Visual Studio Code - Insiders", "/usr/share/code-insiders/code-insiders", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""), new ExternalMerger(3, "kdiff3", "KDiff3", "/usr/bin/kdiff3", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""), @@ -70,7 +70,7 @@ namespace SourceGit.Models else { Supported = new List() { - new ExternalMerger(0, "custom_diff", "Custom", "", "", ""), + new ExternalMerger(0, "git", "Use Git Settings", "", "", ""), }; } } diff --git a/src/Resources/ExternalToolIcons/custom_diff.png b/src/Resources/ExternalToolIcons/custom_diff.png deleted file mode 100644 index 8d046a2f12ebaabe7e7cac974d4acccc109c7699..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1943 zcmV;I2Wa?-P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA2P{cMK~#8N?OSbZ z6h#<*XLqj$#+Fh+`AA8HLM3OUVrmRuy(20}0-=G33c(;?kXV6W#2+ZBf7Bm<3L&UJ z3I;JqwSo$$fr4OyF&KUbk@68ftdO3z2bS9F-Ol*V&R(xyZv9R9~3_Erj&>zL8l3d4ZHUG^?zm@chHf2f^V*q_wGq4aDIfeNmhsaWa}PILauya^XX5 zguOc@qy;Ej#;j{~W-At&2N=7A2Jlp^A>j8z@Z=^fERLiHRi4sn>r{kS=o$hZ=HyW2 zDJ=kwF)O@;MV9Am6KyY`$}@Wv(3wF|J>=PiiWeB;VK@6MRC#8t0x|_vp7H{qripvD z7noj6{h|4^ta1S@t*m6da(_KRm8bk9h^q4N3egrQ!A-r!pcc(_q1c-~RC!9@)2A*F z(XOe8Bp{YV!@>I1E2fD4 zPM&U%7U0R}MB?vvio`$fp#l7$EI`F9(SI5WfWO{=9zIO^Ck6OruetyRI?3@fM1Lnw zH%JTc)UzV-{?FtRyMYUUW7Tqk)IMiX z0b2O}V|%GpA+jJEoFfJ-nlN4Tck*rjW6_ zz|xsQ)sMdxrNx~f_Et7Rt3smxl9|a#uwNX4n+}Mfv9Up|%D55IjieKF@^nM5D_~+9 z#y{$jfb*ef0zLI{i^<&{sAQ}HUY;S8-Mr76$z}O8Tnp&76=ul_NEfO+v*!dcbQ8nF zoE#aefYsB4vg^MS%34ma8A|Z#DLKLSY$v#qSAabS_|XWxZCAibMJGtm2^Ms7f=-@p zkQQLg6C&}uKZwK$Cx{ItCs=Je!Pig#Fi`-4Rv4GF2>~`KIzc3LixYJ6bc6H|a86j| zZD5w)gufqZgRn~2-2oC0MIGhZQ=e2(-VQAjqO2=RPZMh@NLRp{Q-!i`9TLi>>jc+^ z@HS{a4~YAd6_BnIbn^5JH6g}$*v&o*Rh~H~Xm4Hd&J>~Q>pyx^TJKM%{*D_^V*0?0 z0?y(`#4Mh!6IA7ywF=-TuW3+km{6M!$*00SIX$~t zKp(K;n7D%JLX~G$=K$-kI7$WYj*L~nmdAv$%a40g0h=q(2=Vs=&=-W+FZk6P0X}({mg2A1V$zn*JXo~!xOl3YE>wAD zZ4NkJKrZUIisL8$$8i#|cc%@nd3Is?<^KyXMo`Og zLdZ_W*xAroZH#>=C8Py7QcB;zFV|qS;}6}$twNzCfhXMP_d!)#42J0T%hI?W2x>YM zp(E_|{|g`)el7(Vc^V~)CtV=htOG8P7U1XzHc&IzTKqT(I~7QGbbt{!4}Mr^Mqwy6 zEdg*}5QoA5yoB4at@OS@0w@5#AQ3#HZ=!LsA#{m!h$E??bRGCggl%JQngA!m^Q62lwk+vET>w+9|$RURu da!3V${{TH&7KWrINNfNA002ovPDHLkV1n#1f*}9^ diff --git a/src/Resources/ExternalToolIcons/git.png b/src/Resources/ExternalToolIcons/git.png new file mode 100644 index 0000000000000000000000000000000000000000..cbb908b9ce125742e37a372c59469ca97e44b2bf GIT binary patch literal 1223 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPVEzz*rLC6XFWw{)eE@(Ekn&|Ba3R zYis}aRC#7>{K8G|m4o(cYxNH{x*sjIKRFn`wl;igr}N&*@PnP+Cu_a8*81VB}+`Cz3Fl=^4`RABJVM(@3~9?-N8)<8kM zk3eH>^noJpZS+3?#ewRDF*N={A7$jr{kD=00muBmTnYwwycamtLDv**m4zhKegrOTGDTEAiA zrmcJT9Xx#G*s0TJ&Yiz-@zT|6x9>c7^z8ZTH}5}u`uyeVw;w-${r>a!UwP!4+dx+^ zCV9KNRQq4r`iFsmsoK-UF(l&f-D~OPmkmVN5=7Zg<=m*=dSR24TSTfTlkdXT0JB_8 z?KMVD97`7N-7jZZmJ_*eQ>kk0Bf0sL`K!Ll$j5pbCR>$$`FNcF>f1A+m7yP2+rBzA zyKO<(sXSZvMGq_mh37E`ep+*MO1kzkTfKQ(8T$VpJ@Tnut4jIc`<1EYuTT88e)mas z_wS<%CEnSmCvBN8+j;MA#H7Fw1%FHA!W+luGjC2yI@Im5pR3%*<)nAV z>gO+#PBBY#y7N!GF8DDa-Db}#>%b#65&A6mF8L|GI@mB_#pH9Q?+zx+iMYJ*jtCcj zmeaC5i}Y97MA+r1XxTO#o6tDp;m4Y#yVErmne#?|y>&iEntRjoz>hXZxg9TvecmIt zLi<^j;0pCB(+g}5iwu^V#O<=UI_YTfu6YdKT=tutUGT_Op>fd-bH#4eV}1;RB1iw7 z4=TuHpRL;b_Fu#v74_9?T-oBer1Q4VS+iM9vPP*P`sow(Z+Bktem`+i(#(f#dW&|A zkDpxP8!^$A)f2bp8D16MH#0Bz;JJVI<}avG%aXe+JXv9j+wStm&z7%PuI#0d|LiPx zxZK~sikLM4j%(z^TAU*{vb*YsUtyRWH*W_2skpLqEAu}tAKR@2zdO7C*=Ft`BCatn z>dl+is%-lLY?fL`s{2i{nOb4Mx8|?!Cy_^PiXYmZJ$%HLSTpa%!bf_ETO7X{e5|su z@c1t9@%gkD-9M%_ws*YmUTB{BMDfve<2{D03t64{qmP&Ujb-k!?Ufea8~?^-)^z=# zy*3lyrFN^uP0M(;(lyv$byoF`jK_(K=1v#OwT;~JebORsf04TtF+BTcy{|eG%4?tf fud2{T`xpOhwo;C$SBf3LG|AxU>gTe~DWM4fyFxPD literal 0 HcmV?d00001 diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 28afdf9c..25b50e63 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -339,12 +339,10 @@ Input path for installed gpg program User Signing Key User's gpg signing key - EXTERNAL MERGE TOOL - Diff Command - Merge Command - Install Path - Input path for merge tool - Merger + DIFF/MERGE TOOL + Install Path + Input path for diff/merge tool + Tool Prune Remote Target: Pull diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index b1658c34..c2c69099 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -342,12 +342,10 @@ 签名程序所在路径 用户签名KEY 输入签名提交所使用的KEY - 外部合并工具 - 对比模式启动参数 - 合并模式启动参数 - 安装路径 - 填写工具可执行文件所在位置 - 工具 + 对比/合并工具 + 安装路径 + 填写工具可执行文件所在位置 + 工具 清理远程已删除分支 目标 : 拉回(pull) diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 7a8bd837..8cd3c88b 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -342,12 +342,10 @@ gpg.exe所在路徑 使用者簽名KEY 輸入簽名提交所使用的KEY - 外部合併工具 - 對比模式啟動引數 - 合併模式啟動引數 - 安裝路徑 - 填寫工具可執行檔案所在位置 - 工具 + 對比/合併工具 + 安裝路徑 + 填寫工具可執行檔案所在位置 + 工具 清理遠端已刪除分支 目標 : 拉回(pull) diff --git a/src/ViewModels/BranchCompare.cs b/src/ViewModels/BranchCompare.cs index 6b19d249..be133bd2 100644 --- a/src/ViewModels/BranchCompare.cs +++ b/src/ViewModels/BranchCompare.cs @@ -133,19 +133,11 @@ namespace SourceGit.ViewModels diffWithMerger.Icon = App.CreateMenuIcon("Icons.Diff"); diffWithMerger.Click += (_, ev) => { + var toolType = Preference.Instance.ExternalMergeToolType; + var toolPath = Preference.Instance.ExternalMergeToolPath; var opt = new Models.DiffOption(Base.Head, To.Head, change); - var type = Preference.Instance.ExternalMergeToolType; - var exec = Preference.Instance.ExternalMergeToolPath; - var tool = Models.ExternalMerger.Supported.Find(x => x.Type == type); - if (tool == null || !File.Exists(exec)) - { - App.RaiseException(_repo, "Invalid merge tool in preference setting!"); - return; - } - - var args = tool.Type != 0 ? tool.DiffCmd : Preference.Instance.ExternalMergeToolDiffCmd; - Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, exec, args, opt)); + Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, toolType, toolPath, opt)); ev.Handled = true; }; menu.Items.Add(diffWithMerger); diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 430f4b7d..4ab521b8 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -218,19 +218,11 @@ namespace SourceGit.ViewModels diffWithMerger.Icon = App.CreateMenuIcon("Icons.Diff"); diffWithMerger.Click += (_, ev) => { + var toolType = Preference.Instance.ExternalMergeToolType; + var toolPath = Preference.Instance.ExternalMergeToolPath; var opt = new Models.DiffOption(_commit, change); - var type = Preference.Instance.ExternalMergeToolType; - var exec = Preference.Instance.ExternalMergeToolPath; - var tool = Models.ExternalMerger.Supported.Find(x => x.Type == type); - if (tool == null || !File.Exists(exec)) - { - App.RaiseException(_repo, "Invalid merge tool in preference setting!"); - return; - } - - var args = tool.Type != 0 ? tool.DiffCmd : Preference.Instance.ExternalMergeToolDiffCmd; - Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, exec, args, opt)); + Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, toolType, toolPath, opt)); ev.Handled = true; }; menu.Items.Add(diffWithMerger); diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index 53f6839c..8a240752 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -98,18 +98,9 @@ namespace SourceGit.ViewModels public void OpenExternalMergeTool() { - var type = Preference.Instance.ExternalMergeToolType; - var exec = Preference.Instance.ExternalMergeToolPath; - - var tool = Models.ExternalMerger.Supported.Find(x => x.Type == type); - if (tool == null || !File.Exists(exec)) - { - App.RaiseException(_repo, "Invalid merge tool in preference setting!"); - return; - } - - var args = tool.Type != 0 ? tool.DiffCmd : Preference.Instance.ExternalMergeToolDiffCmd; - Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, exec, args, _option)); + var toolType = Preference.Instance.ExternalMergeToolType; + var toolPath = Preference.Instance.ExternalMergeToolPath; + Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, toolType, toolPath, _option)); } private void LoadDiffContent() diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index debe672a..b72fb8c4 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -290,18 +290,6 @@ namespace SourceGit.ViewModels set => SetProperty(ref _externalMergeToolPath, value); } - public string ExternalMergeToolCmd - { - get => _externalMergeToolCmd; - set => SetProperty(ref _externalMergeToolCmd, value); - } - - public string ExternalMergeToolDiffCmd - { - get => _externalMergeToolDiffCmd; - set => SetProperty(ref _externalMergeToolDiffCmd, value); - } - public List Repositories { get; @@ -556,8 +544,6 @@ namespace SourceGit.ViewModels private int _externalMergeToolType = 0; private string _externalMergeToolPath = string.Empty; - private string _externalMergeToolCmd = string.Empty; - private string _externalMergeToolDiffCmd = string.Empty; private AvaloniaList _repositoryNodes = new AvaloniaList(); } diff --git a/src/ViewModels/RevisionCompare.cs b/src/ViewModels/RevisionCompare.cs index 99fae39f..80a06757 100644 --- a/src/ViewModels/RevisionCompare.cs +++ b/src/ViewModels/RevisionCompare.cs @@ -142,18 +142,10 @@ namespace SourceGit.ViewModels diffWithMerger.Click += (_, ev) => { var opt = new Models.DiffOption(StartPoint.SHA, _endPoint, change); - var type = Preference.Instance.ExternalMergeToolType; - var exec = Preference.Instance.ExternalMergeToolPath; + var toolType = Preference.Instance.ExternalMergeToolType; + var toolPath = Preference.Instance.ExternalMergeToolPath; - var tool = Models.ExternalMerger.Supported.Find(x => x.Type == type); - if (tool == null || !File.Exists(exec)) - { - App.RaiseException(_repo, "Invalid merge tool in preference setting!"); - return; - } - - var args = tool.Type != 0 ? tool.DiffCmd : Preference.Instance.ExternalMergeToolDiffCmd; - Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, exec, args, opt)); + Task.Run(() => Commands.MergeTool.OpenForDiff(_repo, toolType, toolPath, opt)); ev.Handled = true; }; menu.Items.Add(diffWithMerger); diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index a0b406cb..434923f2 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1120,20 +1120,11 @@ namespace SourceGit.ViewModels private async void UseExternalMergeTool(Models.Change change) { - var type = Preference.Instance.ExternalMergeToolType; - var exec = Preference.Instance.ExternalMergeToolPath; - - var tool = Models.ExternalMerger.Supported.Find(x => x.Type == type); - if (tool == null) - { - App.RaiseException(_repo.FullPath, "Invalid merge tool in preference setting!"); - return; - } - - var args = tool.Type != 0 ? tool.Cmd : Preference.Instance.ExternalMergeToolCmd; + var toolType = Preference.Instance.ExternalMergeToolType; + var toolPath = Preference.Instance.ExternalMergeToolPath; _repo.SetWatcherEnabled(false); - await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, exec, args, change.Path)); + await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, change.Path)); _repo.SetWatcherEnabled(true); } diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index d502e818..b84354aa 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -449,12 +449,12 @@ - + - + + Margin="0,0,16,0" + IsVisible="{Binding ExternalMergeToolType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/> + Text="{Binding ExternalMergeToolPath, Mode=TwoWay}" + Watermark="{DynamicResource Text.Preference.DiffMerge.Path.Placeholder}" + IsVisible="{Binding ExternalMergeToolType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> - - - - - - diff --git a/src/Views/Preference.axaml.cs b/src/Views/Preference.axaml.cs index cccbd522..2cb9dca4 100644 --- a/src/Views/Preference.axaml.cs +++ b/src/Views/Preference.axaml.cs @@ -287,6 +287,7 @@ namespace SourceGit.Views { ViewModels.Preference.Instance.ExternalMergeToolType = 0; type = 0; + return; } var tool = Models.ExternalMerger.Supported[type];