Skip to content

The Tree API does not allow for file deletion  #1371

@dandonovsc

Description

@dandonovsc

In order to delete a file via the Github REST API v3 a file's sha need to be null as per the documentation

The SHA1 checksum ID of the object in the tree. Also called tree.sha. If the value is null then the file will be deleted.

The library's implementation defines the sha field as a pointer to a string with that will be ignored when json serialized:

type TreeEntry struct {
	SHA     *string 'json:"sha,omitempty"'
         ................
}

When submitting a POST request to the repos/%v/%v/git/trees API with no sha and no content validation fails with response 422 Must supply tree.sha or tree.content []

Please advise how a file should be deleted using the library

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions