Пример #1
0
        private bool UpdateFileInformationFromWorkingTree(MemoryMappedViewAccessor indexView)
        {
            long updatedEntries = 0;

            using (ITracer activity = this.tracer.StartActivity("UpdateFileInformationFromWorkingTree", EventLevel.Informational, Keywords.Telemetry, null))
            {
                WorkingTree.ForAllFiles(
                    this.repoRoot,
                    (path, files) =>
                {
                    foreach (FileInfo file in files)
                    {
                        string gitPath = FromDotnetFullPathToGitRelativePath(file.FullName, this.repoRoot);
                        long offset;
                        if (this.indexEntryOffsets.TryGetValue(gitPath, out offset))
                        {
                            if (NativeMethods.TryStatFileAndUpdateIndex(this.tracer, gitPath, indexView, offset))
                            {
                                Interlocked.Increment(ref updatedEntries);
                            }
                        }
                    }
                });
            }

            return(updatedEntries > 0);
        }
Пример #2
0
        private bool UpdateFileInformationFromWorkingTree(MemoryMappedViewAccessor indexView)
        {
            long updatedEntries = 0;

            using (ITracer activity = this.tracer.StartActivity("UpdateFileInformationFromWorkingTree", EventLevel.Informational, Keywords.Telemetry, null))
            {
                WorkingTree.ForAllFiles(
                    this.repoRoot,
                    (path, files) =>
                    {
                        foreach (FileInfo file in files)
                        {
                            string gitPath = FromWindowsFullPathToGitRelativePath(file.FullName, this.repoRoot);
                            long offset;
                            if (this.indexEntryOffsets.TryGetValue(gitPath, out offset))
                            {
                                IndexEntry indexEntry = new IndexEntry(indexView, offset);
                                indexEntry.Mtime = file.LastWriteTimeUtc;
                                indexEntry.Ctime = file.CreationTimeUtc;
                                indexEntry.Size = (uint)file.Length;
                                Interlocked.Increment(ref updatedEntries);
                            }
                        }
                    });
            }

            return updatedEntries > 0;
        }
Пример #3
0
        private bool UpdateFileInformationFromWorkingTree()
        {
            long updatedEntries = 0;

            using (ITracer activity = this.tracer.StartActivity("UpdateFileInformationFromWorkingTree", EventLevel.Informational))
            {
                WorkingTree.ForAllFiles(
                    this.repoRoot,
                    (path, files) =>
                {
                    foreach (FileInfo file in files)
                    {
                        string gitPath = file.FullName.FromWindowsFullPathToGitRelativePath(this.repoRoot);
                        long offset;
                        if (this.indexEntryOffsets.TryGetValue(gitPath, out offset))
                        {
                            IndexEntry indexEntry = new IndexEntry(this, offset);
                            indexEntry.Mtime      = file.LastWriteTimeUtc;
                            indexEntry.Ctime      = file.CreationTimeUtc;
                            indexEntry.Size       = (uint)file.Length;
                            System.Threading.Interlocked.Increment(ref updatedEntries);
                        }
                    }
                });

                this.indexView.Flush();
            }

            return(updatedEntries > 0);
        }