From 60298a69538ccdda417613a09e5acbd917bfc53a Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sun, 18 Dec 2022 10:42:29 +0530 Subject: git: rework diff to fetch initial commit --- routes/routes.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'routes/routes.go') 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) -- cgit