cerrado @ 87f8598734b44b9421e4252b2c2750f8c979bdd9

feat: Add tar.gz link to commit page
diff --git a/README.md b/README.md
index d3794309eed96979fe40e92c18fc9873e02f33ad..b6eea7b400b6cf92078c001d91876b3aab87d0bf 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,6 @@ To run the project you just need to do a make run.
 
 ### TODO
 
-- Add link to tar browser from commit page
 - Add patch to the commit page
 - Add log pagination
 - Fix submodule link on tree view
diff --git a/templates/commit.qtpl b/templates/commit.qtpl
index 307017214fafd55d950c5c810bc0e8ac60e7a74b..2b58864d816b225ff35e20c1301046d41b7bfca6 100644
--- a/templates/commit.qtpl
+++ b/templates/commit.qtpl
@@ -1,11 +1,16 @@
 {% import "github.com/go-git/go-git/v5/plumbing/object" %}
 
-{% func Commit(name string, c *object.Commit) %}
+{% func Commit(name string, c *object.Commit, showTar bool) %}
   <div class="row event">
     <div class="row">
       <div class="col-md">
        <a title="{%s c.Hash.String() %}" href="/{%s name %}/commit/{%s c.Hash.String() %}">{%s c.Hash.String()[0:8] %}</a>
       </div>
+      {% if showTar %}
+      <div class="col-md text-md-center">
+       <a title="tar.gz for {%s c.Hash.String() %}" href="/{%s name %}/archive/{%s c.Hash.String() %}.tar.gz">tar.gz</a>
+      </div>
+      {% endif %}
       <div class="col-md text-md-end">
        <a title="{%s c.Committer.Email %}" href="mailto:{%s c.Committer.Email %}">{%s c.Committer.Name %}</a>
       </div>
diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go
index 7f4649928a5d7a7c49f91dadb008170a30dc8d12..04d1c9c1aa74769d3201657d54974bd9572672a2 100644
--- a/templates/commit.qtpl.go
+++ b/templates/commit.qtpl.go
@@ -21,7 +21,7 @@ 	_ = qt422016.AcquireByteBuffer
 )
 
 //line commit.qtpl:3
-func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) {
+func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) {
 //line commit.qtpl:3
 	qw422016.N().S(`
   <div class="row event">
@@ -45,56 +45,81 @@ 	qw422016.E().S(c.Hash.String()[0:8])
 //line commit.qtpl:7
 	qw422016.N().S(`</a>
       </div>
+      `)
+//line commit.qtpl:9
+	if showTar {
+//line commit.qtpl:9
+		qw422016.N().S(`
+      <div class="col-md text-md-center">
+       <a title="tar.gz for `)
+//line commit.qtpl:11
+		qw422016.E().S(c.Hash.String())
+//line commit.qtpl:11
+		qw422016.N().S(`" href="/`)
+//line commit.qtpl:11
+		qw422016.E().S(name)
+//line commit.qtpl:11
+		qw422016.N().S(`/archive/`)
+//line commit.qtpl:11
+		qw422016.E().S(c.Hash.String())
+//line commit.qtpl:11
+		qw422016.N().S(`.tar.gz">tar.gz</a>
+      </div>
+      `)
+//line commit.qtpl:13
+	}
+//line commit.qtpl:13
+	qw422016.N().S(`
       <div class="col-md text-md-end">
        <a title="`)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.E().S(c.Committer.Email)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.N().S(`" href="mailto:`)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.E().S(c.Committer.Email)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.N().S(`">`)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.E().S(c.Committer.Name)
-//line commit.qtpl:10
+//line commit.qtpl:15
 	qw422016.N().S(`</a>
       </div>
     </div>
     <div class="code-view">
      <pre>`)
-//line commit.qtpl:14
+//line commit.qtpl:19
 	qw422016.E().S(c.Message)
-//line commit.qtpl:14
+//line commit.qtpl:19
 	qw422016.N().S(`</pre>
     </div>
   </div>
 `)
-//line commit.qtpl:17
+//line commit.qtpl:22
 }
 
-//line commit.qtpl:17
-func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit) {
-//line commit.qtpl:17
+//line commit.qtpl:22
+func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) {
+//line commit.qtpl:22
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line commit.qtpl:17
-	StreamCommit(qw422016, name, c)
-//line commit.qtpl:17
+//line commit.qtpl:22
+	StreamCommit(qw422016, name, c, showTar)
+//line commit.qtpl:22
 	qt422016.ReleaseWriter(qw422016)
-//line commit.qtpl:17
+//line commit.qtpl:22
 }
 
-//line commit.qtpl:17
-func Commit(name string, c *object.Commit) string {
-//line commit.qtpl:17
+//line commit.qtpl:22
+func Commit(name string, c *object.Commit, showTar bool) string {
+//line commit.qtpl:22
 	qb422016 := qt422016.AcquireByteBuffer()
-//line commit.qtpl:17
-	WriteCommit(qb422016, name, c)
-//line commit.qtpl:17
+//line commit.qtpl:22
+	WriteCommit(qb422016, name, c, showTar)
+//line commit.qtpl:22
 	qs422016 := string(qb422016.B)
-//line commit.qtpl:17
+//line commit.qtpl:22
 	qt422016.ReleaseByteBuffer(qb422016)
-//line commit.qtpl:17
+//line commit.qtpl:22
 	return qs422016
-//line commit.qtpl:17
+//line commit.qtpl:22
 }
diff --git a/templates/gititemcommit.qtpl b/templates/gititemcommit.qtpl
index e685f23d3e39c7ac8b44f8291617624c97f9cf92..77536f1d45da568c3317b42096a8628367beb5ac 100644
--- a/templates/gititemcommit.qtpl
+++ b/templates/gititemcommit.qtpl
@@ -10,7 +10,7 @@ {% func (g *GitItemCommitPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Log) %}{% endfunc %}
 
 {% func (g *GitItemCommitPage) GitContent(name, ref string) %}
 <div class="event-list">
-  {%= Commit(name, g.Commit) %}
+  {%= Commit(name, g.Commit, true) %}
 </div>
 
 <div class="alert alert-info text-center" role="alert">
diff --git a/templates/gititemcommit.qtpl.go b/templates/gititemcommit.qtpl.go
index 13c1fa9ae3b12dc697d47280e043e8489b8c83cf..f94a1c2847b72a3a8b92fac0139b465c364671d3 100644
--- a/templates/gititemcommit.qtpl.go
+++ b/templates/gititemcommit.qtpl.go
@@ -65,7 +65,7 @@ 	qw422016.N().S(`
 <div class="event-list">
   `)
 //line gititemcommit.qtpl:13
-	StreamCommit(qw422016, name, g.Commit)
+	StreamCommit(qw422016, name, g.Commit, true)
 //line gititemcommit.qtpl:13
 	qw422016.N().S(`
 </div>
diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl
index ee3841c25c6d12058955b1e3054f64cf2801837a..e5bfc1b7f2e76c0fa7e666fd480f03e20bb7bad6 100644
--- a/templates/gititemlog.qtpl
+++ b/templates/gititemlog.qtpl
@@ -11,7 +11,7 @@
 {% func (g *GitItemLogPage) GitContent(name, ref string) %}
 <div class="event-list">
   {% for _, c := range g.Commits %}
-  {%= Commit(name, c) %}
+  {%= Commit(name, c, false) %}
   {% endfor %}
 </div>
 {% endfunc %}
diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go
index da8167aaed77dad2b6c6ea84a38e77ea9415f284..bb37a0815d9e9b4287a17fb160a66dc06a977778 100644
--- a/templates/gititemlog.qtpl.go
+++ b/templates/gititemlog.qtpl.go
@@ -70,7 +70,7 @@ //line gititemlog.qtpl:13
 		qw422016.N().S(`
   `)
 //line gititemlog.qtpl:14
-		StreamCommit(qw422016, name, c)
+		StreamCommit(qw422016, name, c, false)
 //line gititemlog.qtpl:14
 		qw422016.N().S(`
   `)
diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl
index 44e160474b48574d3c93773fa3780a17529aa480..f2de5bed534fddcf8bd529a36b06b9e2d1f15755 100644
--- a/templates/gititemsummary.qtpl
+++ b/templates/gititemsummary.qtpl
@@ -39,7 +39,7 @@ </div>
 <div class="row">
   <div class="event-list">
     {% for _, c := range g.Commits %}
-    {%= Commit(name, c) %}
+    {%= Commit(name, c, false) %}
     {% endfor %}
   </div>
 </div>
diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go
index 24fed9df74108f464aa3b1685e1fa597559620fc..d70823eb4c78c511c1ab9e775224170a12a22d93 100644
--- a/templates/gititemsummary.qtpl.go
+++ b/templates/gititemsummary.qtpl.go
@@ -142,7 +142,7 @@ //line gititemsummary.qtpl:41
 		qw422016.N().S(`
     `)
 //line gititemsummary.qtpl:42
-		StreamCommit(qw422016, name, c)
+		StreamCommit(qw422016, name, c, false)
 //line gititemsummary.qtpl:42
 		qw422016.N().S(`
     `)