Esempio n. 1
0
			// add a symbolic ref, 1 level deep
			[]string{"symbolic-ref", symbolicRef1, "refs/heads/" + branchName},

			// add a symbolic ref, 2 levels deep
			[]string{"symbolic-ref", symbolicRef2, symbolicRef1},

			// pack the refs
			[]string{"pack-refs"},
		)
		if err != nil {
			return err
		}

		// get the output data
		info := &InfoRefs{
			CommitOid:          util.RevOid(repo, "HEAD"),
			AnnTagName:         annTagName,
			AnnTagOid:          util.RevOid(repo, annTagName),
			LightTagName:       lightTagName,
			BranchName:         branchName,
			SymbolicRef1:       symbolicRef1,
			SymbolicRef1Target: "refs/heads/" + branchName,
			SymbolicRef2:       symbolicRef2,
			SymbolicRef2Target: symbolicRef1,
			HeadTarget:         "refs/heads/master",
		}

		testCase.info = info
		return nil
	},
)
Esempio n. 2
0
		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 {
			return fmt.Errorf("could not commit to repo: %s", err)
		}

		// get the output data
		info := &InfoDerefs{
			TagName:    tagName,
			BranchName: branchName,
			CommitOid:  util.RevOid(repo, "HEAD"),
			TreeOid:    util.RevOid(repo, "HEAD^{tree}"),
			TagOid:     util.RevOid(repo, tagName),
			BlobOid:    blobOid,
			ObjectsN:   4,
			RefsN:      3,
		}

		testCase.info = info
		return nil
	},
)
Esempio n. 3
0
			)
			// create a commits
			err = util.GitExecMany(repo,
				[]string{"add", "--all"},
				[]string{"commit", "-a", "-m", commitMsg},
				[]string{"branch", branchName},
				[]string{"tag", "-a", tagName, "-m", commitMsg},
			)
			if err != nil {
				return fmt.Errorf("could not commit to repo: %s", err)
			}

			// get the output data
			var (
				parentOid = ""
				oid       = util.RevOid(repo, "HEAD")
				tagOid    = util.RevOid(repo, tagName)
			)
			if i != 0 {
				parentOid = util.RevOid(repo, "HEAD^")
			}
			info.Commits[i] = &CommitDetail{
				CommitOid:  oid,
				ParentOid:  parentOid,
				CommitRepr: util.ObjectRepr(repo, oid),
				CommitSize: util.ObjectSize(repo, oid),
				TreeOid:    util.RevOid(repo, oid+"^{tree}"),
				BranchName: branchName,
				TagName:    tagName,
				TagOid:     tagOid,
				TagRepr:    util.ObjectRepr(repo, tagName),