summaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-18 10:42:29 +0530
committerLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-18 10:42:53 +0530
commit60298a69538ccdda417613a09e5acbd917bfc53a (patch)
tree799e52039fca1d7a15138d315b7b1b60d47ba46c /routes
parente4d12fc667c9830dd5f08f827b2a70adff58a09b (diff)
downloadlegit-60298a69538ccdda417613a09e5acbd917bfc53a.tar.gz
legit-60298a69538ccdda417613a09e5acbd917bfc53a.tar.bz2
legit-60298a69538ccdda417613a09e5acbd917bfc53a.zip
git: rework diff to fetch initial commit
Diffstat (limited to '')
-rw-r--r--routes/routes.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/routes/routes.go b/routes/routes.go
index 7e2e897..920e66c 100644
--- a/routes/routes.go
+++ b/routes/routes.go
@@ -106,8 +106,8 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) {
tpath := filepath.Join(d.c.Dirs.Templates, "*")
t := template.Must(template.ParseGlob(tpath))
- if len(commits) >= 5 {
- commits = commits[:5]
+ if len(commits) >= 3 {
+ commits = commits[:3]
}
data := make(map[string]any)
@@ -149,6 +149,7 @@ func (d *deps) RepoTree(w http.ResponseWriter, r *http.Request) {
data["name"] = name
data["ref"] = ref
data["parent"] = treePath
+ data["desc"] = getDescription(path)
d.listFiles(files, data, w)
return
@@ -171,6 +172,7 @@ func (d *deps) FileContent(w http.ResponseWriter, r *http.Request) {
data := make(map[string]any)
data["name"] = name
data["ref"] = ref
+ data["desc"] = getDescription(path)
d.showFile(contents, data, w)
return
@@ -188,7 +190,6 @@ func (d *deps) Log(w http.ResponseWriter, r *http.Request) {
}
commits, err := gr.Commits()
- log.Println(len(commits))
if err != nil {
d.Write500(w)
log.Println(err)
@@ -203,6 +204,7 @@ func (d *deps) Log(w http.ResponseWriter, r *http.Request) {
data["meta"] = d.c.Meta
data["name"] = name
data["ref"] = ref
+ data["desc"] = getDescription(path)
if err := t.ExecuteTemplate(w, "log", data); err != nil {
log.Println(err)
@@ -239,6 +241,7 @@ func (d *deps) Diff(w http.ResponseWriter, r *http.Request) {
data["meta"] = d.c.Meta
data["name"] = name
data["ref"] = ref
+ data["desc"] = getDescription(path)
if err := t.ExecuteTemplate(w, "commit", data); err != nil {
log.Println(err)
@@ -278,6 +281,7 @@ func (d *deps) Refs(w http.ResponseWriter, r *http.Request) {
data["name"] = name
data["branches"] = branches
data["tags"] = tags
+ data["desc"] = getDescription(path)
if err := t.ExecuteTemplate(w, "refs", data); err != nil {
log.Println(err)