コード例 #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;
        }
コード例 #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;
        }
コード例 #3
0
ファイル: GitPackage.cs プロジェクト: erdomke/InnovatorAdmin
        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);
        }