diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-02-15 21:18:06 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-02-15 21:18:06 +0100 |
commit | 998c1777afeeb44ecf6ba2e735a4d6176a9b339e (patch) | |
tree | cd559a07a3a4a2e529947549f6352b6202031a23 /templates/commit.qtpl.go | |
parent | 27400b0fce5d4ef3b7fd5ef4d25bac8f00754e33 (diff) | |
download | cerrado-998c1777afeeb44ecf6ba2e735a4d6176a9b339e.tar.gz cerrado-998c1777afeeb44ecf6ba2e735a4d6176a9b339e.tar.bz2 cerrado-998c1777afeeb44ecf6ba2e735a4d6176a9b339e.zip |
feat: Add tag and branch to log
Now it is possible to see tag and branch on the log page.
Diffstat (limited to 'templates/commit.qtpl.go')
-rw-r--r-- | templates/commit.qtpl.go | 160 |
1 files changed, 115 insertions, 45 deletions
diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go index 75ae899..fda993d 100644 --- a/templates/commit.qtpl.go +++ b/templates/commit.qtpl.go @@ -5,10 +5,10 @@ package templates //line templates/commit.qtpl:1 -import "git.gabrielgio.me/cerrado/pkg/humanize" +import "git.gabrielgio.me/cerrado/pkg/git" //line templates/commit.qtpl:2 -import "github.com/go-git/go-git/v5/plumbing/object" +import "git.gabrielgio.me/cerrado/pkg/humanize" //line templates/commit.qtpl:4 import ( @@ -24,7 +24,7 @@ var ( ) //line templates/commit.qtpl:4 -func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) { +func StreamCommit(qw422016 *qt422016.Writer, name string, c *git.CommitReference, showTar bool) { //line templates/commit.qtpl:4 qw422016.N().S(` <div class="row event"> @@ -32,7 +32,7 @@ func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, show <div class="col-md"> <a title="`) //line templates/commit.qtpl:8 - qw422016.E().S(c.Hash.String()) + qw422016.E().S(c.Commit().Hash.String()) //line templates/commit.qtpl:8 qw422016.N().S(`" href="/`) //line templates/commit.qtpl:8 @@ -40,98 +40,168 @@ func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, show //line templates/commit.qtpl:8 qw422016.N().S(`/commit/`) //line templates/commit.qtpl:8 - qw422016.E().S(c.Hash.String()) + qw422016.E().S(c.Commit().Hash.String()) //line templates/commit.qtpl:8 qw422016.N().S(`/">`) //line templates/commit.qtpl:8 - qw422016.E().S(c.Hash.String()[0:8]) + qw422016.E().S(c.Commit().Hash.String()[0:8]) //line templates/commit.qtpl:8 qw422016.N().S(`</a> — <a title="`) //line templates/commit.qtpl:9 - qw422016.E().S(c.Committer.Email) + qw422016.E().S(c.Commit().Committer.Email) //line templates/commit.qtpl:9 qw422016.N().S(`" href="mailto:`) //line templates/commit.qtpl:9 - qw422016.E().S(c.Author.Email) + qw422016.E().S(c.Commit().Author.Email) //line templates/commit.qtpl:9 qw422016.N().S(`">`) //line templates/commit.qtpl:9 - qw422016.E().S(c.Author.Name) + qw422016.E().S(c.Commit().Author.Name) //line templates/commit.qtpl:9 qw422016.N().S(`</a> + — + `) +//line templates/commit.qtpl:11 + if c.HasReference() { +//line templates/commit.qtpl:11 + qw422016.N().S(` + `) +//line templates/commit.qtpl:12 + for _, r := range c.References() { +//line templates/commit.qtpl:12 + qw422016.N().S(` + `) +//line templates/commit.qtpl:13 + if r.Name().IsBranch() { +//line templates/commit.qtpl:13 + qw422016.N().S(` + <a class="ref branch" title="`) +//line templates/commit.qtpl:14 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:14 + qw422016.N().S(`" href="/`) +//line templates/commit.qtpl:14 + qw422016.E().S(name) +//line templates/commit.qtpl:14 + qw422016.N().S(`/tree/`) +//line templates/commit.qtpl:14 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:14 + qw422016.N().S(`/">`) +//line templates/commit.qtpl:14 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:14 + qw422016.N().S(`</a> + `) +//line templates/commit.qtpl:15 + } else { +//line templates/commit.qtpl:15 + qw422016.N().S(` + <a class="ref tag" title="`) +//line templates/commit.qtpl:16 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:16 + qw422016.N().S(`" href="/`) +//line templates/commit.qtpl:16 + qw422016.E().S(name) +//line templates/commit.qtpl:16 + qw422016.N().S(`/commit/`) +//line templates/commit.qtpl:16 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:16 + qw422016.N().S(`/">`) +//line templates/commit.qtpl:16 + qw422016.E().S(r.Name().Short()) +//line templates/commit.qtpl:16 + qw422016.N().S(`</a> + `) +//line templates/commit.qtpl:17 + } +//line templates/commit.qtpl:17 + qw422016.N().S(` + `) +//line templates/commit.qtpl:18 + } +//line templates/commit.qtpl:18 + qw422016.N().S(` + `) +//line templates/commit.qtpl:19 + } +//line templates/commit.qtpl:19 + qw422016.N().S(` </div> `) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:21 if showTar { -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:21 qw422016.N().S(` <div class="col-md text-md-center"> <a title="tar.gz for `) -//line templates/commit.qtpl:13 - qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:23 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:23 qw422016.N().S(`" href="/`) -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:23 qw422016.E().S(name) -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:23 qw422016.N().S(`/archive/`) -//line templates/commit.qtpl:13 - qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:23 + qw422016.E().S(c.Commit().Hash.String()) +//line templates/commit.qtpl:23 qw422016.N().S(`.tar.gz">tar.gz</a> </div> `) -//line templates/commit.qtpl:15 +//line templates/commit.qtpl:25 } -//line templates/commit.qtpl:15 +//line templates/commit.qtpl:25 qw422016.N().S(` <div class="col-md text-md-end"> <a title="`) -//line templates/commit.qtpl:17 - qw422016.E().S(c.Author.When.UTC().Format("2006-01-02 15:04:05")) -//line templates/commit.qtpl:17 +//line templates/commit.qtpl:27 + qw422016.E().S(c.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")) +//line templates/commit.qtpl:27 qw422016.N().S(` UTC">`) -//line templates/commit.qtpl:17 - qw422016.E().S(humanize.Time(c.Author.When)) -//line templates/commit.qtpl:17 +//line templates/commit.qtpl:27 + qw422016.E().S(humanize.Time(c.Commit().Author.When)) +//line templates/commit.qtpl:27 qw422016.N().S(`</a> </div> </div> <div class="code-view"> <pre>`) -//line templates/commit.qtpl:21 - qw422016.E().S(c.Message) -//line templates/commit.qtpl:21 +//line templates/commit.qtpl:31 + qw422016.E().S(c.Commit().Message) +//line templates/commit.qtpl:31 qw422016.N().S(`</pre> </div> </div> `) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 } -//line templates/commit.qtpl:24 -func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) { -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 +func WriteCommit(qq422016 qtio422016.Writer, name string, c *git.CommitReference, showTar bool) { +//line templates/commit.qtpl:34 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 StreamCommit(qw422016, name, c, showTar) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 qt422016.ReleaseWriter(qw422016) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 } -//line templates/commit.qtpl:24 -func Commit(name string, c *object.Commit, showTar bool) string { -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 +func Commit(name string, c *git.CommitReference, showTar bool) string { +//line templates/commit.qtpl:34 qb422016 := qt422016.AcquireByteBuffer() -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 WriteCommit(qb422016, name, c, showTar) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 qs422016 := string(qb422016.B) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 qt422016.ReleaseByteBuffer(qb422016) -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 return qs422016 -//line templates/commit.qtpl:24 +//line templates/commit.qtpl:34 } |