コード例 #1
0
ファイル: reader_test.go プロジェクト: johnkewforks/go-git
func readFromFile(c *C, file string, f Format) *memory.ObjectStorage {
	d, err := os.Open(file)
	c.Assert(err, IsNil)

	r := NewReader(d)
	r.Format = f

	storage := memory.NewObjectStorage()
	_, err = r.Read(storage)
	c.Assert(err, IsNil)

	return storage
}
コード例 #2
0
ファイル: reader_test.go プロジェクト: johnkewforks/go-git
func (s *ReaderSuite) testReadPackfileGitFixture(c *C, file string, f Format) {
	d, err := os.Open(file)
	c.Assert(err, IsNil)

	r := NewReader(d)
	r.Format = f

	storage := memory.NewObjectStorage()
	_, err = r.Read(storage)
	c.Assert(err, IsNil)

	AssertObjects(c, storage, []string{
		"918c48b83bd081e863dbe1b80f8998f058cd8294",
		"af2d6a6954d532f8ffb47615169c8fdf9d383a1a",
		"1669dce138d9b841a518c64b10914d88f5e488ea",
		"a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69",
		"b8e471f58bcbca63b07bda20e428190409c2db47",
		"35e85108805c84807bc66a02d91535e1e24b38b9",
		"b029517f6300c2da0f4b651b8642506cd6aaf45d",
		"32858aad3c383ed1ff0a0f9bdf231d54a00c9e88",
		"d3ff53e0564a9f87d8e84b6e28e5060e517008aa",
		"c192bd6a24ea1ab01d78686e417c8bdc7c3d197f",
		"d5c0f4ab811897cadf03aec358ae60d21f91c50d",
		"49c6bb89b17060d7b4deacb7b338fcc6ea2352a9",
		"cf4aa3b38974fb7d81f367c0830f7d78d65ab86b",
		"9dea2395f5403188298c1dabe8bdafe562c491e3",
		"586af567d0bb5e771e49bdd9434f5e0fb76d25fa",
		"9a48f23120e880dfbe41f7c9b7b708e9ee62a492",
		"5a877e6a906a2743ad6e45d99c1793642aaf8eda",
		"c8f1d8c61f9da76f4cb49fd86322b6e685dba956",
		"a8d315b2b1c615d43042c3a62402b8a54288cf5c",
		"a39771a7651f97faf5c72e08224d857fc35133db",
		"880cd14280f4b9b6ed3986d6671f907d7cc2a198",
		"fb72698cab7617ac416264415f13224dfd7a165e",
		"4d081c50e250fa32ea8b1313cf8bb7c2ad7627fd",
		"eba74343e2f15d62adedfd8c883ee0262b5c8021",
		"c2d30fa8ef288618f65f6eed6e168e0d514886f4",
		"8dcef98b1d52143e1e2dbc458ffe38f925786bf2",
		"aa9b383c260e1d05fbbf6b30a02914555e20c725",
		"6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
	})
}
コード例 #3
0
ファイル: reader_test.go プロジェクト: johnkewforks/go-git
func (s *ReaderSuite) TestReadPackfile(c *C) {
	data, _ := base64.StdEncoding.DecodeString(packFileWithEmptyObjects)
	d := bytes.NewReader(data)

	r := NewReader(d)

	storage := memory.NewObjectStorage()
	_, err := r.Read(storage)
	c.Assert(err, IsNil)

	AssertObjects(c, storage, []string{
		"778c85ff95b5514fea0ba4c7b6a029d32e2c3b96",
		"db4002e880a08bf6cc7217512ad937f1ac8824a2",
		"551fe11a9ef992763b7e0be4500cf7169f2f8575",
		"3d8d2705c6b936ceff0020989eca90db7a372609",
		"af01d4cac3441bba4bdd4574938e1d231ee5d45e",
		"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
		"85553e8dc42a79b8a483904dcfcdb048fc004055",
		"a028c5b32117ed11bd310a61d50ca10827d853f1",
		"c6b65deb8be57436ceaf920b82d51a3fc59830bd",
		"90b451628d8449f4c47e627eb1392672e5ccec98",
		"496d6428b9cf92981dc9495211e6e1120fb6f2ba",
	})
}
コード例 #4
0
ファイル: repository.go プロジェクト: johnkewforks/go-git
// NewPlainRepository creates a new repository without remotes
func NewPlainRepository() *Repository {
	return &Repository{
		Remotes: map[string]*Remote{},
		Storage: memory.NewObjectStorage(),
	}
}