| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-compare"> |
| 3 | <header class="shithub-code-head"> |
| 4 | <h1> |
| 5 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/tree/{{ .Repo.DefaultBranch }}">{{ .Owner }}/{{ .Repo.Name }}</a> |
| 6 | <span class="shithub-code-sep">/</span> |
| 7 | Compare <code>{{ .Base }}</code> ... <code>{{ .Head }}</code> |
| 8 | </h1> |
| 9 | </header> |
| 10 | |
| 11 | {{ if .NotFound }} |
| 12 | <div class="shithub-compare-empty">One or both refs were not found in this repository.</div> |
| 13 | {{ else }} |
| 14 | <p class="shithub-compare-summary"> |
| 15 | {{ if eq .Base .Head }} |
| 16 | Base and head are the same — nothing to compare. |
| 17 | {{ else if le .Ahead 0 }} |
| 18 | There isn't anything to compare. <code>{{ .Head }}</code> is up to date with <code>{{ .Base }}</code>. |
| 19 | {{ else }} |
| 20 | <strong>{{ .Ahead }}</strong> commit{{ if ne .Ahead 1 }}s{{ end }} ahead, <strong>{{ .Behind }}</strong> behind <code>{{ .Base }}</code>. |
| 21 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/pulls/new?base={{ .Base }}&head={{ .Head }}" class="shithub-button shithub-button-primary">Create pull request</a> |
| 22 | {{ end }} |
| 23 | </p> |
| 24 | |
| 25 | {{ if .Commits }} |
| 26 | <section class="shithub-compare-commits"> |
| 27 | <h2>Commits in <code>{{ .Head }}</code></h2> |
| 28 | <ul class="shithub-commits-list"> |
| 29 | {{ range .Commits }} |
| 30 | <li class="shithub-commits-row"> |
| 31 | <div class="shithub-commits-meta"> |
| 32 | <a class="shithub-commits-subject" href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .OID }}">{{ .Subject }}</a> |
| 33 | <code class="shithub-commits-sha">{{ .ShortOID }}</code> |
| 34 | <small>{{ .AuthorName }} · <time datetime="{{ .AuthorWhen.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .AuthorWhen }}</time></small> |
| 35 | </div> |
| 36 | </li> |
| 37 | {{ end }} |
| 38 | </ul> |
| 39 | </section> |
| 40 | {{ end }} |
| 41 | |
| 42 | {{ if .DiffHTML }} |
| 43 | <section class="shithub-diff-body" aria-label="Diff"> |
| 44 | {{ safeHTML .DiffHTML }} |
| 45 | </section> |
| 46 | {{ end }} |
| 47 | {{ end }} |
| 48 | </section> |
| 49 | {{- end }} |