Beispiel #1
0
	func(testCase *RepoTestCase) error {
		repo, err := createRepo(testCase)
		if err != nil {
			return err
		}

		name := "myfile1.txt"
		contents := "one"
		err = util.TestFile(repo, name, contents)
		if err != nil {
			return fmt.Errorf("could not create test file for repo: %s", err)
		}

		// hacky: figure out the blob oid of the file above
		var blobOid string
		blobOid, err = util.HashBlob(repo, contents)
		if err != nil {
			return fmt.Errorf("could not figure out blob oid: %s", err)
		}

		tagName := "0.0.0"
		branchName := "brooklyn"

		// create a single commit
		err = util.GitExecMany(repo,
			[]string{"add", "--all"},
			[]string{"commit", "-a", "-m", "\"First and only commit\""},
			[]string{"tag", "-a", tagName, "-m", "\"My tag!\""},
			[]string{"branch", branchName},
		)
		if err != nil {
Beispiel #2
0
}

var Blobs = NewRepoTestCase(
	"__blobs",
	func(testCase *RepoTestCase) error {
		repo, err := createRepo(testCase)
		if err != nil {
			return err
		}

		info := &InfoBlobs{
			Blobs: make([]*BlobDetail, 0),
			N:     len(testCasesBlobContents),
		}

		// hash the test objects
		for _, contents := range testCasesBlobContents {
			if oidStr, err := util.HashBlob(repo, contents); err != nil {
				return err
			} else {
				info.Blobs = append(info.Blobs, &BlobDetail{
					oidStr,
					contents,
				})
			}
		}
		testCase.info = info
		return nil
	},
)