@@ -30,6 +30,13 @@ func (t Tree) String() string {
3030// TreeEntry represents the contents of a tree structure. TreeEntry can
3131// represent either a blob, a commit (in the case of a submodule), or another
3232// tree.
33+ //
34+ // When used with [GitService.CreateTree], set Content for small text files,
35+ // or set SHA to reference an existing blob (use [GitService.CreateBlob] for
36+ // binary files or large content). To delete an entry, set both Content and SHA
37+ // to nil; the entry will be serialized with `"sha": null` which the API interprets
38+ // as a deletion. When deleting, the Type and Mode fields are ignored; only Path
39+ // is required.
3340type TreeEntry struct {
3441 SHA * string `json:"sha,omitempty"`
3542 Path * string `json:"path,omitempty"`
@@ -127,6 +134,12 @@ type createTree struct {
127134// path modifying that tree are specified, it will overwrite the contents of
128135// that tree with the new path contents and write a new tree out.
129136//
137+ // When baseTree is provided, entries are merged with that tree: paths not
138+ // mentioned in entries are preserved from the base tree. If the same path
139+ // appears multiple times in entries, the last entry wins. To delete an entry,
140+ // include a [TreeEntry] with the path and both SHA and Content set to nil.
141+ // Entire directories can be deleted this way.
142+ //
130143// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree
131144//
132145//meta:operation POST /repos/{owner}/{repo}/git/trees
0 commit comments