aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_log.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http_handle_repo_log.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/http_handle_repo_log.go b/http_handle_repo_log.go
index b37923b..cbc3284 100644
--- a/http_handle_repo_log.go
+++ b/http_handle_repo_log.go
@@ -2,25 +2,23 @@ package main
import (
"net/http"
-
- "github.com/go-git/go-git/v5/plumbing"
)
// TODO: I probably shouldn't include *all* commits here...
func handle_repo_log(w http.ResponseWriter, r *http.Request, params map[string]any) {
- group_name, repo_name, ref_name := params["group_name"].(string), params["repo_name"].(string), params["ref_name"].(string)
- repo, description, err := open_git_repo(r.Context(), group_name, repo_name)
+ repo, description, err := open_git_repo(r.Context(), params["group_name"].(string), params["repo_name"].(string))
if err != nil {
http.Error(w, "Error opening repo: "+err.Error(), http.StatusInternalServerError)
return
}
params["repo_description"] = description
- ref, err := repo.Reference(plumbing.NewBranchReferenceName(ref_name), true)
+
+ ref_hash, err := get_ref_hash_from_type_and_name(repo, params["ref_type"].(string), params["ref_name"].(string))
if err != nil {
- http.Error(w, "Error getting repo reference: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
return
}
- ref_hash := ref.Hash()
+
commits, err := get_recent_commits(repo, ref_hash, -1)
if err != nil {
http.Error(w, "Error getting recent commits: "+err.Error(), http.StatusInternalServerError)