aboutsummaryrefslogtreecommitdiff
path: root/object
diff options
context:
space:
mode:
Diffstat (limited to 'object')
-rw-r--r--object/blob_parse_test.go6
-rw-r--r--object/blob_serialize_test.go4
-rw-r--r--object/commit_parse_test.go6
-rw-r--r--object/commit_serialize_test.go6
-rw-r--r--object/tag_parse_test.go10
-rw-r--r--object/tag_serialize_test.go8
-rw-r--r--object/tree_helpers_test.go16
-rw-r--r--object/tree_parse_test.go10
-rw-r--r--object/tree_serialize_test.go6
9 files changed, 36 insertions, 36 deletions
diff --git a/object/blob_parse_test.go b/object/blob_parse_test.go
index ad0f7ef3..ea0a279e 100644
--- a/object/blob_parse_test.go
+++ b/object/blob_parse_test.go
@@ -11,11 +11,11 @@ import (
func TestBlobParseFromGit(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
+ testRepo := testgit.NewBareRepo(t, algo)
body := []byte("hello\nblob\n")
- blobID := repo.HashObject(t, "blob", body)
+ blobID := testRepo.HashObject(t, "blob", body)
- rawBody := repo.CatFile(t, "blob", blobID)
+ rawBody := testRepo.CatFile(t, "blob", blobID)
blob, err := object.ParseBlob(rawBody)
if err != nil {
t.Fatalf("ParseBlob: %v", err)
diff --git a/object/blob_serialize_test.go b/object/blob_serialize_test.go
index 07811365..4853d980 100644
--- a/object/blob_serialize_test.go
+++ b/object/blob_serialize_test.go
@@ -10,9 +10,9 @@ import (
func TestBlobSerialize(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
+ testRepo := testgit.NewBareRepo(t, algo)
body := []byte("hello\nblob\n")
- wantID := repo.HashObject(t, "blob", body)
+ wantID := testRepo.HashObject(t, "blob", body)
blob := &object.Blob{Data: body}
rawObj, err := blob.SerializeWithHeader()
diff --git a/object/commit_parse_test.go b/object/commit_parse_test.go
index e1bfb3d1..66061f73 100644
--- a/object/commit_parse_test.go
+++ b/object/commit_parse_test.go
@@ -11,10 +11,10 @@ import (
func TestCommitParseFromGit(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- _, treeID, commitID := repo.MakeCommit(t, "subject\n\nbody")
+ testRepo := testgit.NewBareRepo(t, algo)
+ _, treeID, commitID := testRepo.MakeCommit(t, "subject\n\nbody")
- rawBody := repo.CatFile(t, "commit", commitID)
+ rawBody := testRepo.CatFile(t, "commit", commitID)
commit, err := object.ParseCommit(rawBody, algo)
if err != nil {
t.Fatalf("ParseCommit: %v", err)
diff --git a/object/commit_serialize_test.go b/object/commit_serialize_test.go
index 5f4cf0cf..9067d511 100644
--- a/object/commit_serialize_test.go
+++ b/object/commit_serialize_test.go
@@ -10,10 +10,10 @@ import (
func TestCommitSerialize(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- _, _, commitID := repo.MakeCommit(t, "subject\n\nbody")
+ testRepo := testgit.NewBareRepo(t, algo)
+ _, _, commitID := testRepo.MakeCommit(t, "subject\n\nbody")
- rawBody := repo.CatFile(t, "commit", commitID)
+ rawBody := testRepo.CatFile(t, "commit", commitID)
commit, err := object.ParseCommit(rawBody, algo)
if err != nil {
t.Fatalf("ParseCommit: %v", err)
diff --git a/object/tag_parse_test.go b/object/tag_parse_test.go
index 84d29069..4131e3f1 100644
--- a/object/tag_parse_test.go
+++ b/object/tag_parse_test.go
@@ -6,17 +6,17 @@ import (
"codeberg.org/lindenii/furgit/internal/testgit"
"codeberg.org/lindenii/furgit/object"
- "codeberg.org/lindenii/furgit/objecttype"
"codeberg.org/lindenii/furgit/objectid"
+ "codeberg.org/lindenii/furgit/objecttype"
)
func TestTagParseFromGit(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- _, _, commitID := repo.MakeCommit(t, "subject\n\nbody")
- tagID := repo.TagAnnotated(t, "v1", commitID, "tag message")
+ testRepo := testgit.NewBareRepo(t, algo)
+ _, _, commitID := testRepo.MakeCommit(t, "subject\n\nbody")
+ tagID := testRepo.TagAnnotated(t, "v1", commitID, "tag message")
- rawBody := repo.CatFile(t, "tag", tagID)
+ rawBody := testRepo.CatFile(t, "tag", tagID)
tag, err := object.ParseTag(rawBody, algo)
if err != nil {
t.Fatalf("ParseTag: %v", err)
diff --git a/object/tag_serialize_test.go b/object/tag_serialize_test.go
index 435259b4..3f1f8b0b 100644
--- a/object/tag_serialize_test.go
+++ b/object/tag_serialize_test.go
@@ -10,11 +10,11 @@ import (
func TestTagSerialize(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- _, _, commitID := repo.MakeCommit(t, "subject\n\nbody")
- tagID := repo.TagAnnotated(t, "v1", commitID, "tag message")
+ testRepo := testgit.NewBareRepo(t, algo)
+ _, _, commitID := testRepo.MakeCommit(t, "subject\n\nbody")
+ tagID := testRepo.TagAnnotated(t, "v1", commitID, "tag message")
- rawBody := repo.CatFile(t, "tag", tagID)
+ rawBody := testRepo.CatFile(t, "tag", tagID)
tag, err := object.ParseTag(rawBody, algo)
if err != nil {
t.Fatalf("ParseTag: %v", err)
diff --git a/object/tree_helpers_test.go b/object/tree_helpers_test.go
index ce7160d6..539d7542 100644
--- a/object/tree_helpers_test.go
+++ b/object/tree_helpers_test.go
@@ -61,20 +61,20 @@ func gitLsTreeNames(out []byte) [][]byte {
return names
}
-func adversarialRootEntries(t *testing.T, repo *testgit.TestRepo) []object.TreeEntry {
+func adversarialRootEntries(t *testing.T, testRepo *testgit.TestRepo) []object.TreeEntry {
t.Helper()
- blobA := repo.HashObject(t, "blob", []byte("blob-A\n"))
- blobB := repo.HashObject(t, "blob", []byte("blob-B\n"))
- blobC := repo.HashObject(t, "blob", []byte("blob-C\n"))
+ blobA := testRepo.HashObject(t, "blob", []byte("blob-A\n"))
+ blobB := testRepo.HashObject(t, "blob", []byte("blob-B\n"))
+ blobC := testRepo.HashObject(t, "blob", []byte("blob-C\n"))
- subDirA := repo.Mktree(t,
+ subDirA := testRepo.Mktree(t,
fmt.Sprintf("100644 blob %s\tnested-a.txt\n100755 blob %s\trun-a.sh\n", blobA.String(), blobB.String()))
- subDirB := repo.Mktree(t,
+ subDirB := testRepo.Mktree(t,
fmt.Sprintf("100644 blob %s\tnested-b.txt\n100644 blob %s\tz-last\n", blobB.String(), blobC.String()))
- subDirC := repo.Mktree(t,
+ subDirC := testRepo.Mktree(t,
fmt.Sprintf("120000 blob %s\tlink-c\n100644 blob %s\tchild\n", blobC.String(), blobA.String()))
- subDirD := repo.Mktree(t,
+ subDirD := testRepo.Mktree(t,
fmt.Sprintf("100644 blob %s\tleaf\n", blobA.String()))
return []object.TreeEntry{
diff --git a/object/tree_parse_test.go b/object/tree_parse_test.go
index 09c396e3..e1c81d58 100644
--- a/object/tree_parse_test.go
+++ b/object/tree_parse_test.go
@@ -11,8 +11,8 @@ import (
func TestTreeParseFromGit(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- entries := adversarialRootEntries(t, repo)
+ testRepo := testgit.NewBareRepo(t, algo)
+ entries := adversarialRootEntries(t, testRepo)
inserted := &object.Tree{}
for _, entry := range entries {
if err := inserted.InsertEntry(entry); err != nil {
@@ -20,9 +20,9 @@ func TestTreeParseFromGit(t *testing.T) {
}
}
- treeID := repo.Mktree(t, buildGitMktreeInput(inserted.Entries))
+ treeID := testRepo.Mktree(t, buildGitMktreeInput(inserted.Entries))
- rawBody := repo.CatFile(t, "tree", treeID)
+ rawBody := testRepo.CatFile(t, "tree", treeID)
tree, err := object.ParseTree(rawBody, algo)
if err != nil {
t.Fatalf("ParseTree: %v", err)
@@ -40,7 +40,7 @@ func TestTreeParseFromGit(t *testing.T) {
}
}
- lsNames := gitLsTreeNames(repo.RunBytes(t, "ls-tree", "--name-only", "-z", treeID.String()))
+ lsNames := gitLsTreeNames(testRepo.RunBytes(t, "ls-tree", "--name-only", "-z", treeID.String()))
if len(lsNames) != len(tree.Entries) {
t.Fatalf("ls-tree names = %d, want %d", len(lsNames), len(tree.Entries))
}
diff --git a/object/tree_serialize_test.go b/object/tree_serialize_test.go
index 462eff9d..8e84a67b 100644
--- a/object/tree_serialize_test.go
+++ b/object/tree_serialize_test.go
@@ -10,8 +10,8 @@ import (
func TestTreeSerialize(t *testing.T) {
testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) {
- repo := testgit.NewBareRepo(t, algo)
- entries := adversarialRootEntries(t, repo)
+ testRepo := testgit.NewBareRepo(t, algo)
+ entries := adversarialRootEntries(t, testRepo)
tree := &object.Tree{}
for i := len(entries) - 1; i >= 0; i-- {
@@ -45,7 +45,7 @@ func TestTreeSerialize(t *testing.T) {
t.Fatalf("Entry(%q) should exist after reinsert", removed.Name)
}
- wantTreeID := repo.Mktree(t, buildGitMktreeInput(tree.Entries))
+ wantTreeID := testRepo.Mktree(t, buildGitMktreeInput(tree.Entries))
rawObj, err := tree.SerializeWithHeader()
if err != nil {