forked from p85947160/gitea
Merge pull request #135 from clee/show-parents
Show parents in commit diff page
This commit is contained in:
commit
31805e2bbe
|
@ -91,10 +91,22 @@ func Diff(ctx *middleware.Context, params martini.Params) {
|
||||||
return isImage
|
return isImage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parents := make([]string, commit.ParentCount())
|
||||||
|
for i := 0; i < commit.ParentCount(); i++ {
|
||||||
|
sha, err := commit.ParentId(i)
|
||||||
|
parents[i] = sha.String()
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(404, "repo.Diff", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["Username"] = userName
|
||||||
|
ctx.Data["Reponame"] = repoName
|
||||||
ctx.Data["IsImageFile"] = isImageFile
|
ctx.Data["IsImageFile"] = isImageFile
|
||||||
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId)
|
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId)
|
||||||
ctx.Data["Commit"] = commit
|
ctx.Data["Commit"] = commit
|
||||||
ctx.Data["Diff"] = diff
|
ctx.Data["Diff"] = diff
|
||||||
|
ctx.Data["Parents"] = parents
|
||||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||||
ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["IsRepoToolbarCommits"] = true
|
||||||
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
|
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
|
||||||
|
|
|
@ -8,9 +8,16 @@
|
||||||
<a class="pull-right btn btn-primary btn-sm" rel="nofollow" href="{{.SourcePath}}">Browse Source</a>
|
<a class="pull-right btn btn-primary btn-sm" rel="nofollow" href="{{.SourcePath}}">Browse Source</a>
|
||||||
<h4>{{.Commit.Message}}</h4>
|
<h4>{{.Commit.Message}}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
{{ $username := .Username }}
|
||||||
|
{{ $reponame := .Reponame }}
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
commit <span class="label label-default sha">{{ShortSha .CommitId}}</span>
|
<ul class="list-unstyled">
|
||||||
|
{{range .Parents}}
|
||||||
|
<li>parent <a href="/{{$username}}/{{$reponame}}/commit/{{.}}"><span class="label label-default sha">{{ShortSha .}}</span></a></li>
|
||||||
|
{{end}}
|
||||||
|
<li>commit <span class="label label-default sha">{{ShortSha .CommitId}}</span></li>
|
||||||
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
<p class="author">
|
<p class="author">
|
||||||
<img class="avatar" src="{{AvatarLink .Commit.Author.Email}}" alt=""/>
|
<img class="avatar" src="{{AvatarLink .Commit.Author.Email}}" alt=""/>
|
||||||
|
|
Loading…
Reference in New Issue