From 8ee5ddca8fec08c23d3e7cb4cedd4886798ae9e2 Mon Sep 17 00:00:00 2001 From: noClaps Date: Fri, 26 Sep 2025 09:47:16 +0100 Subject: [PATCH] knotserver: remove unused functions Signed-off-by: noClaps --- knotserver/git/git.go | 33 --------------------------------- knotserver/http_util.go | 4 ---- 2 files changed, 37 deletions(-) diff --git a/knotserver/git/git.go b/knotserver/git/git.go index 60613b83..e9dc4320 100644 --- a/knotserver/git/git.go +++ b/knotserver/git/git.go @@ -120,14 +120,6 @@ func (g *GitRepo) Commit(h plumbing.Hash) (*object.Commit, error) { return g.r.CommitObject(h) } -func (g *GitRepo) LastCommit() (*object.Commit, error) { - c, err := g.r.CommitObject(g.h) - if err != nil { - return nil, fmt.Errorf("last commit: %w", err) - } - return c, nil -} - func (g *GitRepo) FileContentN(path string, cap int64) ([]byte, error) { c, err := g.r.CommitObject(g.h) if err != nil { @@ -162,31 +154,6 @@ func (g *GitRepo) FileContentN(path string, cap int64) ([]byte, error) { return buf.Bytes(), nil } -func (g *GitRepo) FileContent(path string) (string, error) { - c, err := g.r.CommitObject(g.h) - if err != nil { - return "", fmt.Errorf("commit object: %w", err) - } - - tree, err := c.Tree() - if err != nil { - return "", fmt.Errorf("file tree: %w", err) - } - - file, err := tree.File(path) - if err != nil { - return "", err - } - - isbin, _ := file.IsBinary() - - if !isbin { - return file.Contents() - } else { - return "", ErrBinaryFile - } -} - func (g *GitRepo) RawContent(path string) ([]byte, error) { c, err := g.r.CommitObject(g.h) if err != nil { diff --git a/knotserver/http_util.go b/knotserver/http_util.go index b0ee4d1e..e4be3cfc 100644 --- a/knotserver/http_util.go +++ b/knotserver/http_util.go @@ -16,7 +16,3 @@ func writeError(w http.ResponseWriter, msg string, status int) { w.WriteHeader(status) json.NewEncoder(w).Encode(map[string]string{"error": msg}) } - -func notFound(w http.ResponseWriter) { - writeError(w, "not found", http.StatusNotFound) -} -- 2.51.2