示例#1
0
	BlobOid    string
	ObjectsN   int
	RefsN      int
}

var Derefs = NewRepoTestCase(
	"__derefs",
	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
示例#2
0
	func(testCase *RepoTestCase) error {
		n := 10
		repo, err := createRepo(testCase)
		if err != nil {
			return err
		}
		if n < 1 {
			return errors.New("n must be > 0")
		}
		info := &InfoLinear{
			Commits: make([]*CommitDetail, n),
			N:       n,
		}
		for i := 0; i < n; i++ {
			name := fmt.Sprintf("%d.txt", i)
			err = util.TestFile(repo, name, string(i))
			if err != nil {
				return errors.New("could not create test file for repo: " + err.Error())
			}

			var (
				branchName = fmt.Sprintf("branch_%d", i)
				tagName    = fmt.Sprintf("tag_%d", i)
				commitMsg  = fmt.Sprintf("\"Commit: %d\"", i)
			)
			// create a commits
			err = util.GitExecMany(repo,
				[]string{"add", "--all"},
				[]string{"commit", "-a", "-m", commitMsg},
				[]string{"branch", branchName},
				[]string{"tag", "-a", tagName, "-m", commitMsg},