private Repository Init(URIish u) { InitCommand command = Git.Init(); command.SetBare(bare); if (directory == null) { directory = new FilePath(u.GetHumanishName(), Constants.DOT_GIT); } command.SetDirectory(directory); return(command.Call().GetRepository()); }
public virtual void TestInitBareRepository() { FilePath directory = CreateTempDirectory("testInitBareRepository"); InitCommand command = new InitCommand(); command.SetDirectory(directory); command.SetBare(true); Repository repository = command.Call().GetRepository(); AddRepoToClose(repository); NUnit.Framework.Assert.IsNotNull(repository); NUnit.Framework.Assert.IsTrue(repository.IsBare); }
/// <exception cref="NGit.Api.Errors.GitAPIException"></exception> private Repository Init(URIish u) { InitCommand command = Git.Init(); command.SetBare(bare); if (directory == null) { directory = new FilePath(u.GetHumanishName(), Constants.DOT_GIT); } if (directory.Exists() && directory.ListFiles().Length != 0) { throw new JGitInternalException(MessageFormat.Format(JGitText.Get().cloneNonEmptyDirectory , directory.GetName())); } command.SetDirectory(directory); return(command.Call().GetRepository()); }
public virtual void TestInitBareRepository() { try { FilePath directory = CreateTempDirectory("testInitBareRepository"); InitCommand command = new InitCommand(); command.SetDirectory(directory); command.SetBare(true); Repository repository = command.Call().GetRepository(); NUnit.Framework.Assert.IsNotNull(repository); NUnit.Framework.Assert.IsTrue(repository.IsBare); } catch (Exception e) { NUnit.Framework.Assert.Fail(e.Message); } }