コード例 #1
0
        public virtual void TestInitRepository()
        {
            FilePath    directory = CreateTempDirectory("testInitRepository");
            InitCommand command   = new InitCommand();

            command.SetDirectory(directory);
            Repository repository = command.Call().GetRepository();

            AddRepoToClose(repository);
            NUnit.Framework.Assert.IsNotNull(repository);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 public virtual void TestInitRepository()
 {
     try
     {
         FilePath    directory = CreateTempDirectory("testInitRepository");
         InitCommand command   = new InitCommand();
         command.SetDirectory(directory);
         Repository repository = command.Call().GetRepository();
         NUnit.Framework.Assert.IsNotNull(repository);
     }
     catch (Exception e)
     {
         NUnit.Framework.Assert.Fail(e.Message);
     }
 }
コード例 #4
0
        public virtual void TestInitNonEmptyRepository()
        {
            FilePath directory = CreateTempDirectory("testInitRepository2");
            FilePath someFile  = new FilePath(directory, "someFile");

            someFile.CreateNewFile();
            NUnit.Framework.Assert.IsTrue(someFile.Exists());
            NUnit.Framework.Assert.IsTrue(directory.ListFiles().Length > 0);
            InitCommand command = new InitCommand();

            command.SetDirectory(directory);
            Repository repository = command.Call().GetRepository();

            AddRepoToClose(repository);
            NUnit.Framework.Assert.IsNotNull(repository);
        }
コード例 #5
0
        /// <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());
        }