示例#1
0
        public CommonRepoSetup()
        {
            MockTracer tracer = new MockTracer();

            string gitBinPath = GitProcess.GetInstalledGitBinPath();

            if (string.IsNullOrWhiteSpace(gitBinPath))
            {
                Assert.Fail("Failed to find git.exe");
            }

            string         enlistmentRoot = @"mock:\GVFS\UnitTests\Repo";
            GVFSEnlistment enlistment     = new GVFSEnlistment(enlistmentRoot, "fake://repoUrl", gitBinPath, null);

            enlistment.InitializeLocalCacheAndObjectsPathsFromKey("fake:\\objectCache", "fakeObjectCacheKey");

            this.GitParentPath    = enlistment.WorkingDirectoryRoot;
            this.GVFSMetadataPath = enlistment.DotGVFSRoot;

            MockDirectory enlistmentDirectory = new MockDirectory(
                enlistmentRoot,
                new MockDirectory[]
            {
                new MockDirectory(this.GitParentPath, folders: null, files: null),
            },
                null);

            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git\\config"), ".git config Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git\\HEAD"), ".git HEAD Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git\\logs\\HEAD"), "HEAD Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git\\info\\always_exclude"), "always_exclude Contents", createDirectories: true);
            enlistmentDirectory.CreateDirectory(Path.Combine(this.GitParentPath, ".git\\objects\\pack"));

            MockFileSystem fileSystem = new MockFileSystem(enlistmentDirectory);

            this.Repository = new MockGitRepo(
                tracer,
                enlistment,
                fileSystem);
            CreateStandardGitTree(this.Repository);

            this.Context = new GVFSContext(tracer, fileSystem, this.Repository, enlistment);

            this.HttpObjects = new MockHttpGitObjects(tracer, enlistment);
            this.GitObjects  = new MockGVFSGitObjects(this.Context, this.HttpObjects);
        }
示例#2
0
        public CommonRepoSetup()
        {
            MockTracer tracer = new MockTracer();

            string         enlistmentRoot = Path.Combine("mock:", "GVFS", "UnitTests", "Repo");
            GVFSEnlistment enlistment     = new GVFSEnlistment(enlistmentRoot, "fake://repoUrl", "fake://gitBinPath", null);

            enlistment.InitializeCachePathsFromKey("fake:\\gvfsSharedCache", "fakeCacheKey");

            this.GitParentPath    = enlistment.WorkingDirectoryRoot;
            this.GVFSMetadataPath = enlistment.DotGVFSRoot;

            MockDirectory enlistmentDirectory = new MockDirectory(
                enlistmentRoot,
                new MockDirectory[]
            {
                new MockDirectory(this.GitParentPath, folders: null, files: null),
            },
                null);

            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git", "config"), ".git config Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git", "HEAD"), ".git HEAD Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git", "logs", "HEAD"), "HEAD Contents", createDirectories: true);
            enlistmentDirectory.CreateFile(Path.Combine(this.GitParentPath, ".git", "info", "always_exclude"), "always_exclude Contents", createDirectories: true);
            enlistmentDirectory.CreateDirectory(Path.Combine(this.GitParentPath, ".git", "objects", "pack"));

            MockFileSystem fileSystem = new MockFileSystem(enlistmentDirectory);

            this.Repository = new MockGitRepo(
                tracer,
                enlistment,
                fileSystem);
            CreateStandardGitTree(this.Repository);

            this.Context = new GVFSContext(tracer, fileSystem, this.Repository, enlistment);

            this.HttpObjects = new MockHttpGitObjects(tracer, enlistment);
            this.GitObjects  = new MockGVFSGitObjects(this.Context, this.HttpObjects);
        }