Example #1
0
 ///	<summary>
 /// Add a single repository to the set that is exported by this daemon.
 ///	<para />
 ///	The existence (or lack-thereof) of <code>git-daemon-export-ok</code> is
 ///	ignored by this method. The repository is always published.
 ///	</summary>
 ///	<param name="name">
 /// name the repository will be published under.
 /// </param>
 ///	<param name="db">the repository instance. </param>
 public void ExportRepository(string name, Repository db)
 {
     if (!name.EndsWith(Constants.DOT_GIT_EXT))
     {
         name = name + Constants.DOT_GIT_EXT;
     }
     Exports.Add(name, db);
     RepositoryCache.register(db);
 }
Example #2
0
        public void testCacheRegisterOpen()
        {
            DirectoryInfo dir = db.Directory;

            RepositoryCache.register(db);
            using (Core.Repository exact = RepositoryCache.open(RepositoryCache.FileKey.exact(dir)))
            {
                Assert.AreSame(db, exact);
            }

            Assert.IsTrue(dir.Name.EndsWith(Constants.DOT_GIT_EXT));
            Assert.AreEqual(Constants.DOT_GIT, dir.Name);
            DirectoryInfo parent = dir.Parent;

            using (Core.Repository lenient = RepositoryCache.open(RepositoryCache.FileKey.lenient(parent)))
            {
                Assert.AreSame(db, lenient);
            }

            RepositoryCache.close(db);
        }