From 1173b0b357fa69a666a80c8936e662aaaf23c8ba Mon Sep 17 00:00:00 2001 From: Rob Figueiredo Date: Sat, 6 Sep 2014 13:10:29 -0400 Subject: [PATCH] Adding omitempty to base_tree in CreateTree API A recent update to the GitHub API changed some undocumented behavior. Previously a nonexistent base_tree and an empty string base_tree were treated the same, but now the empty string case will fail with "422 base_tree is not a valid oid". --- github/git_trees.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/git_trees.go b/github/git_trees.go index ebf8870..9efa4b3 100644 --- a/github/git_trees.go +++ b/github/git_trees.go @@ -58,7 +58,7 @@ func (s *GitService) GetTree(owner string, repo string, sha string, recursive bo // createTree represents the body of a CreateTree request. type createTree struct { - BaseTree string `json:"base_tree"` + BaseTree string `json:"base_tree,omitempty"` Entries []TreeEntry `json:"tree"` }