From a9a76e741806ce92c7de5aadee8d22c4863d94e4 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 16 Jun 2021 15:58:51 +0800 Subject: [PATCH] feature: just link subtree when prefix is already exists --- src/Commands/SubTree.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Commands/SubTree.cs b/src/Commands/SubTree.cs index 6c963d09..62f632fe 100644 --- a/src/Commands/SubTree.cs +++ b/src/Commands/SubTree.cs @@ -1,4 +1,5 @@ using System; +using System.IO; namespace SourceGit.Commands { /// @@ -17,6 +18,9 @@ namespace SourceGit.Commands { } public bool Add(string prefix, string source, string revision, bool squash, Action onProgress) { + var path = Path.Combine(Cwd, prefix); + if (Directory.Exists(path)) return true; + handler = onProgress; Args = $"subtree add --prefix=\"{prefix}\" {source} {revision}"; if (squash) Args += " --squash";