Ejemplo n.º 1
0
func (s *Server) buildGitUploadPackInfo(ref *plumbing.Reference) *common.GitUploadPackInfo {
	info := common.NewGitUploadPackInfo()
	info.Refs.SetReference(ref)
	info.Refs.SetReference(plumbing.NewSymbolicReference(plumbing.HEAD, ref.Name()))
	info.Capabilities.Set("symref", "HEAD:"+ref.Name().String())

	return info
}
Ejemplo n.º 2
0
// Info returns the references info and capabilities from the service
func (s *GitUploadPackService) Info() (*common.GitUploadPackInfo, error) {
	url := fmt.Sprintf(
		"%s/info/refs?service=%s",
		s.endpoint.String(), common.GitUploadPackServiceName,
	)

	res, err := s.doRequest("GET", url, nil)
	if err != nil {
		return nil, err
	}

	defer res.Body.Close()

	i := common.NewGitUploadPackInfo()
	return i, i.Decode(res.Body)
}