diff --git a/knotserver/http_util.go b/knotserver/http_util.go --- a/knotserver/http_util.go +++ b/knotserver/http_util.go @@ -16,7 +16,3 @@ w.WriteHeader(status) json.NewEncoder(w).Encode(map[string]string{"error": msg}) } - -func notFound(w http.ResponseWriter) { - writeError(w, "not found", http.StatusNotFound) -} diff --git a/knotserver/git/git.go b/knotserver/git/git.go --- a/knotserver/git/git.go +++ b/knotserver/git/git.go @@ -120,14 +120,6 @@ 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 { @@ -160,31 +152,6 @@ } 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) {