Esempio n. 1
0
        public GitDiffDirectory(Commit commit)
        {
            var files = new List <IDiffFile>();

            GitMergeOperation.WalkTree(commit.Tree, (path, blob) =>
            {
                files.Add(new GitDiffFile(blob)
                {
                    Path = path
                });
            });
            _files = files;
        }
Esempio n. 2
0
        public GitDiffDirectory(Commit commit, string root = null)
        {
            var files = new List <IDiffFile>();

            root = string.IsNullOrEmpty(root) ? "\\" : "\\" + root.Trim('\\').Replace('/', '\\') + "\\";
            GitMergeOperation.WalkTree(commit.Tree, (path, blob) =>
            {
                if (("\\" + path).StartsWith(root))
                {
                    files.Add(new GitDiffFile(blob)
                    {
                        Path = path
                    });
                }
            });
            _files = files;
        }
Esempio n. 3
0
        public GitPackage(Repository repository, Commit commit, string root = null)
        {
            _repository = repository;
            var files = new List <IPackageFile>();

            root = string.IsNullOrEmpty(root) ? "\\" : "\\" + root.Trim('\\').Replace('/', '\\') + "\\";
            GitMergeOperation.WalkTree(commit.Tree, (path, blob) =>
            {
                if (("\\" + path).Replace('/', '\\').StartsWith(root))
                {
                    var relPath = path.Substring(root.Length - 1).TrimStart('/', '\\');
                    files.Add(new GitDiffFile(blob)
                    {
                        Path = relPath
                    });
                }
            });
            _files = files.ToDictionary(f => f.Path);
        }