コード例 #1
0
        private Index GetSourceIndex()
        {
            string indexPath = Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName);

            if (File.Exists(indexPath))
            {
                Index output = new Index(this.Enlistment.EnlistmentRoot, this.Tracer, indexPath, readOnly: true);
                output.Parse();
                return(output);
            }

            return(null);
        }
コード例 #2
0
ファイル: Index.cs プロジェクト: wjmjimmie/GVFS
        private bool UpdateFileInformationFromBackup(bool shouldAlsoTryPopulateFromDisk, out bool indexFound)
        {
            indexFound = (this.backupIndexPath != null) && File.Exists(this.backupIndexPath);
            if (!indexFound)
            {
                return(false);
            }

            using (ITracer activity = this.tracer.StartActivity("UpdateFileInformationFromPreviousIndex", EventLevel.Informational, Keywords.Telemetry, null))
            {
                Index backupIndex = new Index(this.repoRoot, this.tracer, indexReadOnly: true, indexFullPath: this.backupIndexPath, backupIndexFullPath: null, backupIndex: false);
                backupIndex.Parse();
                return(this.UpdateFileInformationFromAnotherIndex(backupIndex, shouldAlsoTryPopulateFromDisk));
            }
        }
コード例 #3
0
        private Index GetSourceIndex()
        {
            string indexPath       = Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName);
            string backupIndexPath = Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName + ".backup");

            if (File.Exists(indexPath))
            {
                // Note that this moves the current index, leaving nothing behind
                // This is intentional as we only need it for the purpose of updating the
                // new index and leaving it behind can make updating slower.
                this.Tracer.RelatedEvent(EventLevel.Informational, "CreateBackup", new EventMetadata()
                {
                    { "BackupIndexName", backupIndexPath }
                });
                File.Delete(backupIndexPath);
                File.Move(indexPath, backupIndexPath);

                Index output = new Index(this.Enlistment.EnlistmentRoot, this.Tracer, backupIndexPath, readOnly: true);
                output.Parse();
                return(output);
            }

            return(null);
        }