forked from tangled.org/core
this repo has no description

knotserver: remove unused functions

Signed-off-by: noClaps <git@zerolimits.dev>

Changed files
-37
knotserver
-33
knotserver/git/git.go
···
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 {
···
}
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) {
-4
knotserver/http_util.go
···
w.WriteHeader(status)
json.NewEncoder(w).Encode(map[string]string{"error": msg})
}
-
-
func notFound(w http.ResponseWriter) {
-
writeError(w, "not found", http.StatusNotFound)
-
}