public void AddRemote() { const string name = "foo"; const string path = "a\\b\\c"; const string output = "bar"; using (_executable.StageOutput($"remote add \"{name}\" \"{path.ToPosixPath()}\"", output)) { Assert.AreEqual(output, _gitModule.AddRemote(name, path)); } Assert.AreEqual("Please enter a name.", _gitModule.AddRemote("", path)); Assert.AreEqual("Please enter a name.", _gitModule.AddRemote(null, path)); }
private void Clone(IHostedRepository repo) { string targetDir = GetTargetDir(); if (targetDir == null) { return; } string repoSrc = repo.CloneReadWriteUrl; var cmd = GitCommandHelpers.CloneCmd(repoSrc, targetDir, depth: GetDepth()); var formRemoteProcess = new FormRemoteProcess(new VsrModule(null), AppSettings.VsrCommand, cmd) { Remote = repoSrc }; formRemoteProcess.ShowDialog(); if (formRemoteProcess.ErrorOccurred()) { return; } var module = new VsrModule(targetDir); if (addUpstreamRemoteAsCB.Text.Trim().Length > 0 && !string.IsNullOrEmpty(repo.ParentReadOnlyUrl)) { var error = module.AddRemote(addUpstreamRemoteAsCB.Text.Trim(), repo.ParentReadOnlyUrl); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(this, error, _strCouldNotAddRemote.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } } _gitModuleChanged?.Invoke(this, new VsrModuleEventArgs(module)); Close(); }