| 868 | } |
| 869 | |
| 870 | func (d *Github) getBranchHead() (string, error) { |
| 871 | res, err := d.client.R().Get(fmt.Sprintf("https://api.github.com/repos/%s/%s/branches/%s", d.Owner, d.Repo, d.Ref)) |
| 872 | if err != nil { |
| 873 | return "", err |
| 874 | } |
| 875 | if res.StatusCode() != 200 { |
| 876 | return "", toErr(res) |
| 877 | } |
| 878 | var resp BranchResp |
| 879 | if err = utils.Json.Unmarshal(res.Body(), &resp); err != nil { |
| 880 | return "", err |
| 881 | } |
| 882 | return resp.Commit.Sha, nil |
| 883 | } |
| 884 | |
| 885 | func (d *Github) copyWithoutRenewTree(srcObj, dstDir model.Obj) (dstSha, newSha, srcParentSha string, srcParentTree *TreeResp, err error) { |
| 886 | dst, err := d.get(dstDir.GetPath()) |