diff --git a/src/Recyclarr.TrashLib/Config/Settings/SettingsValues.cs b/src/Recyclarr.TrashLib/Config/Settings/SettingsValues.cs index 15228219..9f9ac940 100644 --- a/src/Recyclarr.TrashLib/Config/Settings/SettingsValues.cs +++ b/src/Recyclarr.TrashLib/Config/Settings/SettingsValues.cs @@ -4,7 +4,7 @@ namespace Recyclarr.TrashLib.Config.Settings; public record TrashRepository { - public string CloneUrl { get; [UsedImplicitly] init; } = "https://github.com/TRaSH-/Guides.git"; + public Uri CloneUrl { get; [UsedImplicitly] init; } = new("https://github.com/TRaSH-/Guides.git"); public string Branch { get; [UsedImplicitly] init; } = "master"; public string? Sha1 { get; [UsedImplicitly] init; } public string? GitPath { get; [UsedImplicitly] init; } diff --git a/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepository.cs b/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepository.cs index d15c5548..cb3d37d5 100644 --- a/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepository.cs +++ b/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepository.cs @@ -81,12 +81,12 @@ public sealed class GitRepository : IGitRepository await RunGitCmd("reset", "--hard", toBranchOrSha1); } - public async Task SetRemote(string name, string newUrl) + public async Task SetRemote(string name, Uri newUrl) { - await RunGitCmd("remote", "set-url", name, newUrl); + await RunGitCmd("remote", "set-url", name, newUrl.ToString()); } - public async Task Clone(string cloneUrl, string? branch = null) + public async Task Clone(Uri cloneUrl, string? branch = null) { var args = new List {"clone"}; if (branch is not null) @@ -94,7 +94,7 @@ public sealed class GitRepository : IGitRepository args.AddRange(new[] {"-b", branch}); } - args.AddRange(new[] {cloneUrl, _paths.RepoDirectory.FullName}); + args.AddRange(new[] {cloneUrl.ToString(), _paths.RepoDirectory.FullName}); await RunGitCmd(args); } } diff --git a/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepositoryFactory.cs b/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepositoryFactory.cs index 094e4db6..d71626c4 100644 --- a/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepositoryFactory.cs +++ b/src/Recyclarr.TrashLib/Repo/VersionControl/GitRepositoryFactory.cs @@ -15,7 +15,7 @@ public class GitRepositoryFactory : IGitRepositoryFactory _log = log; } - public async Task CreateAndCloneIfNeeded(string repoUrl, string repoPath, string branch) + public async Task CreateAndCloneIfNeeded(Uri repoUrl, string repoPath, string branch) { var repo = _repoFactory(repoPath); diff --git a/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepository.cs b/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepository.cs index a953beb0..69506bf0 100644 --- a/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepository.cs +++ b/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepository.cs @@ -7,8 +7,8 @@ public interface IGitRepository : IDisposable Task ForceCheckout(string branch); Task Fetch(string remote = "origin"); Task ResetHard(string toBranchOrSha1); - Task SetRemote(string name, string newUrl); + Task SetRemote(string name, Uri newUrl); IDirectoryInfo Path { get; } - Task Clone(string cloneUrl, string? branch = null); + Task Clone(Uri cloneUrl, string? branch = null); Task Status(); } diff --git a/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepositoryFactory.cs b/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepositoryFactory.cs index cacdbb1e..aa5d2b55 100644 --- a/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepositoryFactory.cs +++ b/src/Recyclarr.TrashLib/Repo/VersionControl/IGitRepositoryFactory.cs @@ -2,5 +2,5 @@ namespace Recyclarr.TrashLib.Repo.VersionControl; public interface IGitRepositoryFactory { - Task CreateAndCloneIfNeeded(string repoUrl, string repoPath, string branch); + Task CreateAndCloneIfNeeded(Uri repoUrl, string repoPath, string branch); }