Monorepo for Tangled tangled.org

knotserver: remove unused functions #603

merged opened by handle.invalid targeting master from [deleted fork]: knotserver/cleanup
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:s6urhemct6hiuyd5ytdlvnuw/sh.tangled.repo.pull/3lzq2x6w32322
-71
Diff #0
-34
knotserver/git/diff.go
··· 98 98 return &nd, nil 99 99 } 100 100 101 - func (g *GitRepo) DiffTree(commit1, commit2 *object.Commit) (*types.DiffTree, error) { 102 - tree1, err := commit1.Tree() 103 - if err != nil { 104 - return nil, err 105 - } 106 - 107 - tree2, err := commit2.Tree() 108 - if err != nil { 109 - return nil, err 110 - } 111 - 112 - diff, err := object.DiffTree(tree1, tree2) 113 - if err != nil { 114 - return nil, err 115 - } 116 - 117 - patch, err := diff.Patch() 118 - if err != nil { 119 - return nil, err 120 - } 121 - 122 - diffs, _, err := gitdiff.Parse(strings.NewReader(patch.String())) 123 - if err != nil { 124 - return nil, err 125 - } 126 - 127 - return &types.DiffTree{ 128 - Rev1: commit1.Hash.String(), 129 - Rev2: commit2.Hash.String(), 130 - Patch: patch.String(), 131 - Diff: diffs, 132 - }, nil 133 - } 134 - 135 101 // FormatPatch generates a git-format-patch output between two commits, 136 102 // and returns the raw format-patch series, a parsed FormatPatch and an error. 137 103 func (g *GitRepo) formatSinglePatch(commit plumbing.Hash, extraArgs ...string) (string, *types.FormatPatch, error) {
-33
knotserver/git/git.go
··· 120 120 return g.r.CommitObject(h) 121 121 } 122 122 123 - func (g *GitRepo) LastCommit() (*object.Commit, error) { 124 - c, err := g.r.CommitObject(g.h) 125 - if err != nil { 126 - return nil, fmt.Errorf("last commit: %w", err) 127 - } 128 - return c, nil 129 - } 130 - 131 123 func (g *GitRepo) FileContentN(path string, cap int64) ([]byte, error) { 132 124 c, err := g.r.CommitObject(g.h) 133 125 if err != nil { ··· 162 154 return buf.Bytes(), nil 163 155 } 164 156 165 - func (g *GitRepo) FileContent(path string) (string, error) { 166 - c, err := g.r.CommitObject(g.h) 167 - if err != nil { 168 - return "", fmt.Errorf("commit object: %w", err) 169 - } 170 - 171 - tree, err := c.Tree() 172 - if err != nil { 173 - return "", fmt.Errorf("file tree: %w", err) 174 - } 175 - 176 - file, err := tree.File(path) 177 - if err != nil { 178 - return "", err 179 - } 180 - 181 - isbin, _ := file.IsBinary() 182 - 183 - if !isbin { 184 - return file.Contents() 185 - } else { 186 - return "", ErrBinaryFile 187 - } 188 - } 189 - 190 157 func (g *GitRepo) RawContent(path string) ([]byte, error) { 191 158 c, err := g.r.CommitObject(g.h) 192 159 if err != nil {
-4
knotserver/http_util.go
··· 16 16 w.WriteHeader(status) 17 17 json.NewEncoder(w).Encode(map[string]string{"error": msg}) 18 18 } 19 - 20 - func notFound(w http.ResponseWriter) { 21 - writeError(w, "not found", http.StatusNotFound) 22 - }

History

2 rounds 1 comment
sign up or login to add to the discussion
1 commit
expand
ee2c1a79
knotserver: remove unused functions
expand 1 comment

nice, thanks!

pull request successfully merged
handle.invalid submitted #0
1 commit
expand
900d2118
knotserver: remove unused functions
expand 0 comments