aboutsummaryrefslogtreecommitdiff
path: root/git_plumbing.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 18:26:51 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 18:26:51 +0800
commit4f4f6a25be2625b4bb2cb10e3520f52c4a35c243 (patch)
tree5458da1ee5efa5e46e831c34c1f39ebc67fb71b0 /git_plumbing.go
parentRemove renderReadmeAtTree (diff)
downloadforge-4f4f6a25be2625b4bb2cb10e3520f52c4a35c243.tar.gz
forge-4f4f6a25be2625b4bb2cb10e3520f52c4a35c243.tar.zst
forge-4f4f6a25be2625b4bb2cb10e3520f52c4a35c243.zip
Separate code/README rendering and unsafe to their own packages
Diffstat (limited to 'git_plumbing.go')
-rw-r--r--git_plumbing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/git_plumbing.go b/git_plumbing.go
index 15329ad..74c80ac 100644
--- a/git_plumbing.go
+++ b/git_plumbing.go
@@ -13,6 +13,8 @@ import (
"path"
"sort"
"strings"
+
+ "go.lindenii.runxiyu.org/forge/misc"
)
func writeTree(ctx context.Context, repoPath string, entries []treeEntry) (string, error) {
@@ -76,14 +78,14 @@ func buildTreeRecursive(ctx context.Context, repoPath, baseTree string, updates
if modeEnd < 0 {
return errors.New("invalid tree format")
}
- mode := bytesToString(data[i : i+modeEnd])
+ mode := misc.BytesToString(data[i : i+modeEnd])
i += modeEnd + 1
nameEnd := bytes.IndexByte(data[i:], 0)
if nameEnd < 0 {
return errors.New("missing null after filename")
}
- name := bytesToString(data[i : i+nameEnd])
+ name := misc.BytesToString(data[i : i+nameEnd])
i += nameEnd + 1
if i+20 > len(data) {