Example #1
0
func (s *SuiteCommon) TestGitUploadPackInfoEmpty(c *C) {
	b := bytes.NewBuffer(nil)

	i := NewGitUploadPackInfo()
	err := i.Decode(pktline.NewDecoder(b))
	c.Assert(err, ErrorMatches, "permanent.*empty.*")
}
Example #2
0
func (s *GitUploadPackService) Info() (*common.GitUploadPackInfo, error) {
	url := fmt.Sprintf("%s/info/refs?service=%s", s.endpoint, 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(pktline.NewDecoder(res.Body))
}
Example #3
0
func (s *SuiteCommon) TestGitUploadPackInfo(c *C) {
	b, _ := base64.StdEncoding.DecodeString(GitUploadPackInfoFixture)

	i := NewGitUploadPackInfo()
	err := i.Decode(pktline.NewDecoder(bytes.NewBuffer(b)))
	c.Assert(err, IsNil)

	ref := i.Capabilities.SymbolicReference("HEAD")
	c.Assert(ref, Equals, "refs/heads/master")
	c.Assert(i.Refs[ref].String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
	c.Assert(i.Head.String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5")
}