internal static IndexPack Create(Repository db, Stream stream) { DirectoryInfo objdir = db.ObjectsDirectory; FileInfo tmp = CreateTempFile("incoming_", PackSuffix, objdir); string n = tmp.Name; var basef = new FileInfo(Path.Combine(objdir.ToString(), n.Slice(0, n.Length - PackSuffix.Length))); var ip = new IndexPack(db, stream, basef); ip.setIndexVersion(db.Config.getCore().getPackIndexVersion()); return ip; }
private void VerifyOpenPack(bool thin) { IndexPack indexer; Stream @is; if (thin) { @is = new MemoryStream(_os.ToArray()); indexer = new IndexPack(db, @is, _packBase); try { indexer.index(new TextProgressMonitor()); Assert.Fail("indexer should grumble about missing object"); } catch (IOException) { // expected } } @is = new MemoryStream(_os.ToArray()); indexer = new IndexPack(db, @is, _packBase); indexer.setKeepEmpty(true); indexer.setFixThin(thin); indexer.setIndexVersion(2); indexer.index(new TextProgressMonitor()); _pack = new PackFile(_indexFile, _packFile); }