Exemple #1
0
 /// <summary>
 /// Run the diff operation. Until this is called, all lists will be empty
 /// </summary>
 /// <returns>true if anything is different between index, tree, and workdir</returns>
 private void UpdateDirectoryRecursive(string path)
 {
     var commit = Repository.Head.CurrentCommit;
     _tree = (commit != null ? commit.Tree : new Core.Tree(Repository));
     _index = Repository.Index.GitIndex;
     _index.RereadIfNecessary();
     DirectoryInfo root = _index.Repository.WorkingDirectory;
     var visitor = new AbstractIndexTreeVisitor { VisitEntryAux = OnVisitEntry };
     new IndexTreeWalker(_index, _tree, CreateWorkingDirectoryTree(path), root, visitor).Walk();
 }
Exemple #2
0
        private void UpdateSingleFile(string file)
        {
            TreeEntry treeEntry = null;
            var commit = Repository.Head.CurrentCommit;
            _tree = commit != null ? commit.Tree : null;
            if (_tree != null)
                treeEntry = _tree.FindBlobMember (file);

            _index = Repository.Index.GitIndex;
            _index.RereadIfNecessary();
            GitIndex.Entry indexEntry = _index.GetEntry (file);

            TreeEntry wdirEntry = null;
            FileInfo fileInfo = new FileInfo (Path.Combine (Repository.WorkingDirectory, file.Replace ('/', Path.DirectorySeparatorChar)));
            if (fileInfo.Exists && !IgnoreHandler.IsIgnored(file)) {
                var tree = new Core.Tree(Repository._internal_repo);
                wdirEntry = tree.AddFile (file);
            }

            OnVisitEntry (treeEntry, wdirEntry, indexEntry, fileInfo);
        }
Exemple #3
0
 /// <summary>
 /// Run the diff operation. Until this is called, all lists will be empty
 /// </summary>
 /// <returns>true if anything is different between index, tree, and workdir</returns>
 private bool Diff()
 {
     var commit = Repository.Head.CurrentCommit;
     _tree = (commit != null ? commit.Tree : new Core.Tree(Repository));
     _index = Repository.Index.GitIndex;
     _index.RereadIfNecessary();
     DirectoryInfo root = _index.Repository.WorkingDirectory;
     var visitor = new AbstractIndexTreeVisitor { VisitEntryAux = OnVisitEntry };
     new IndexTreeWalker(_index, _tree, CreateWorkingDirectoryTree(Repository), root, visitor).Walk();
     return AnyDifferences;
 }