Exemplo n.º 1
0
        public ActionResult ViewCommit(string repo, string @object)
        {
            var resourceInfo = this.FileManager.GetResourceInfo(repo);

            if (resourceInfo.Type != ResourceType.Directory)
            {
                return(HttpNotFound());
            }

            AddRepoBreadCrumb(repo);
            this.BreadCrumbs.Append("Browse", "ViewCommit", @object, new { repo, @object });

            var commit = GitUtilities.GetLogEntries(resourceInfo.FullPath, 1, 0, @object).FirstOrDefault();

            if (commit == null)
            {
                return(HttpNotFound());
            }

            var diffs = GitUtilities.GetDiffInfo(resourceInfo.FullPath, commit.Parents.FirstOrDefault() ?? GitUtilities.EmptyTreeHash, commit.CommitHash);

            ViewBag.RepoName       = resourceInfo.Name;
            ViewBag.CommitLogEntry = commit;

            return(View(diffs));
        }