diff options
Diffstat (limited to 'internal/testgit')
| -rw-r--r-- | internal/testgit/algorithms.go | 12 | ||||
| -rw-r--r-- | internal/testgit/repo.go | 4 | ||||
| -rw-r--r-- | internal/testgit/repo_cat_file.go | 4 | ||||
| -rw-r--r-- | internal/testgit/repo_commit_tree.go | 6 | ||||
| -rw-r--r-- | internal/testgit/repo_hash_object.go | 6 | ||||
| -rw-r--r-- | internal/testgit/repo_make_commit.go | 4 | ||||
| -rw-r--r-- | internal/testgit/repo_make_single_file_tree.go | 4 | ||||
| -rw-r--r-- | internal/testgit/repo_mktree.go | 6 | ||||
| -rw-r--r-- | internal/testgit/repo_new.go | 8 | ||||
| -rw-r--r-- | internal/testgit/repo_properties.go | 4 | ||||
| -rw-r--r-- | internal/testgit/repo_rev_parse.go | 6 | ||||
| -rw-r--r-- | internal/testgit/repo_tag_annotated.go | 4 |
12 files changed, 34 insertions, 34 deletions
diff --git a/internal/testgit/algorithms.go b/internal/testgit/algorithms.go index 833b846b..6d7a7565 100644 --- a/internal/testgit/algorithms.go +++ b/internal/testgit/algorithms.go @@ -3,19 +3,19 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // SupportedAlgorithms returns all object ID algorithms supported by furgit. -func SupportedAlgorithms() []oid.Algorithm { - return []oid.Algorithm{ - oid.AlgorithmSHA1, - oid.AlgorithmSHA256, +func SupportedAlgorithms() []objectid.Algorithm { + return []objectid.Algorithm{ + objectid.AlgorithmSHA1, + objectid.AlgorithmSHA256, } } // ForEachAlgorithm runs a subtest for every supported algorithm. -func ForEachAlgorithm(t *testing.T, fn func(t *testing.T, algo oid.Algorithm)) { +func ForEachAlgorithm(t *testing.T, fn func(t *testing.T, algo objectid.Algorithm)) { t.Helper() for _, algo := range SupportedAlgorithms() { t.Run(algo.String(), func(t *testing.T) { diff --git a/internal/testgit/repo.go b/internal/testgit/repo.go index c2d8b088..7118aa7a 100644 --- a/internal/testgit/repo.go +++ b/internal/testgit/repo.go @@ -1,10 +1,10 @@ package testgit -import "codeberg.org/lindenii/furgit/oid" +import "codeberg.org/lindenii/furgit/objectid" // TestRepo is a temporary git repository harness for integration tests. type TestRepo struct { dir string - algo oid.Algorithm + algo objectid.Algorithm env []string } diff --git a/internal/testgit/repo_cat_file.go b/internal/testgit/repo_cat_file.go index 7533e484..c905521f 100644 --- a/internal/testgit/repo_cat_file.go +++ b/internal/testgit/repo_cat_file.go @@ -3,11 +3,11 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // CatFile returns raw output from git cat-file. -func (repo *TestRepo) CatFile(tb testing.TB, mode string, id oid.ObjectID) []byte { +func (repo *TestRepo) CatFile(tb testing.TB, mode string, id objectid.ObjectID) []byte { tb.Helper() return repo.RunBytes(tb, "cat-file", mode, id.String()) } diff --git a/internal/testgit/repo_commit_tree.go b/internal/testgit/repo_commit_tree.go index b5f2f587..1b33b5c0 100644 --- a/internal/testgit/repo_commit_tree.go +++ b/internal/testgit/repo_commit_tree.go @@ -3,11 +3,11 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // CommitTree creates a commit from a tree and message, optionally with parents. -func (repo *TestRepo) CommitTree(tb testing.TB, tree oid.ObjectID, message string, parents ...oid.ObjectID) oid.ObjectID { +func (repo *TestRepo) CommitTree(tb testing.TB, tree objectid.ObjectID, message string, parents ...objectid.ObjectID) objectid.ObjectID { tb.Helper() args := []string{"commit-tree", tree.String()} for _, p := range parents { @@ -15,7 +15,7 @@ func (repo *TestRepo) CommitTree(tb testing.TB, tree oid.ObjectID, message strin } args = append(args, "-m", message) hex := repo.Run(tb, args...) - id, err := oid.ParseHex(repo.algo, hex) + id, err := objectid.ParseHex(repo.algo, hex) if err != nil { tb.Fatalf("parse commit-tree output %q: %v", hex, err) } diff --git a/internal/testgit/repo_hash_object.go b/internal/testgit/repo_hash_object.go index 97a86be5..b21e1231 100644 --- a/internal/testgit/repo_hash_object.go +++ b/internal/testgit/repo_hash_object.go @@ -3,14 +3,14 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // HashObject hashes and writes an object and returns its object ID. -func (repo *TestRepo) HashObject(tb testing.TB, objType string, body []byte) oid.ObjectID { +func (repo *TestRepo) HashObject(tb testing.TB, objType string, body []byte) objectid.ObjectID { tb.Helper() hex := repo.RunInput(tb, body, "hash-object", "-t", objType, "-w", "--stdin") - id, err := oid.ParseHex(repo.algo, hex) + id, err := objectid.ParseHex(repo.algo, hex) if err != nil { tb.Fatalf("parse git hash-object output %q: %v", hex, err) } diff --git a/internal/testgit/repo_make_commit.go b/internal/testgit/repo_make_commit.go index a329ee8a..35619334 100644 --- a/internal/testgit/repo_make_commit.go +++ b/internal/testgit/repo_make_commit.go @@ -3,11 +3,11 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // MakeCommit creates a commit over a single-file tree and returns (blobID, treeID, commitID). -func (repo *TestRepo) MakeCommit(tb testing.TB, message string) (oid.ObjectID, oid.ObjectID, oid.ObjectID) { +func (repo *TestRepo) MakeCommit(tb testing.TB, message string) (objectid.ObjectID, objectid.ObjectID, objectid.ObjectID) { tb.Helper() blobID, treeID := repo.MakeSingleFileTree(tb, "file.txt", []byte("commit-body\n")) commitID := repo.CommitTree(tb, treeID, message) diff --git a/internal/testgit/repo_make_single_file_tree.go b/internal/testgit/repo_make_single_file_tree.go index 69b2362e..a0ccce9b 100644 --- a/internal/testgit/repo_make_single_file_tree.go +++ b/internal/testgit/repo_make_single_file_tree.go @@ -4,11 +4,11 @@ import ( "fmt" "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // MakeSingleFileTree writes one blob and one tree entry for it and returns (blobID, treeID). -func (repo *TestRepo) MakeSingleFileTree(tb testing.TB, fileName string, fileContent []byte) (oid.ObjectID, oid.ObjectID) { +func (repo *TestRepo) MakeSingleFileTree(tb testing.TB, fileName string, fileContent []byte) (objectid.ObjectID, objectid.ObjectID) { tb.Helper() blobID := repo.HashObject(tb, "blob", fileContent) treeInput := fmt.Sprintf("100644 blob %s\t%s\n", blobID.String(), fileName) diff --git a/internal/testgit/repo_mktree.go b/internal/testgit/repo_mktree.go index bd2785e2..0d3f0ea7 100644 --- a/internal/testgit/repo_mktree.go +++ b/internal/testgit/repo_mktree.go @@ -3,14 +3,14 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // Mktree creates a tree from textual mktree input and returns its ID. -func (repo *TestRepo) Mktree(tb testing.TB, input string) oid.ObjectID { +func (repo *TestRepo) Mktree(tb testing.TB, input string) objectid.ObjectID { tb.Helper() hex := repo.RunInput(tb, []byte(input), "mktree") - id, err := oid.ParseHex(repo.algo, hex) + id, err := objectid.ParseHex(repo.algo, hex) if err != nil { tb.Fatalf("parse mktree output %q: %v", hex, err) } diff --git a/internal/testgit/repo_new.go b/internal/testgit/repo_new.go index 51277f78..308d8156 100644 --- a/internal/testgit/repo_new.go +++ b/internal/testgit/repo_new.go @@ -4,22 +4,22 @@ import ( "os" "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // NewBareRepo creates a temporary bare repository initialized with the requested algorithm. -func NewBareRepo(tb testing.TB, algo oid.Algorithm) *TestRepo { +func NewBareRepo(tb testing.TB, algo objectid.Algorithm) *TestRepo { tb.Helper() return newRepo(tb, algo, true) } // NewWorkRepo creates a temporary non-bare repository initialized with the requested algorithm. -func NewWorkRepo(tb testing.TB, algo oid.Algorithm) *TestRepo { +func NewWorkRepo(tb testing.TB, algo objectid.Algorithm) *TestRepo { tb.Helper() return newRepo(tb, algo, false) } -func newRepo(tb testing.TB, algo oid.Algorithm, bare bool) *TestRepo { +func newRepo(tb testing.TB, algo objectid.Algorithm, bare bool) *TestRepo { tb.Helper() if algo.Size() == 0 { tb.Fatalf("invalid algorithm: %v", algo) diff --git a/internal/testgit/repo_properties.go b/internal/testgit/repo_properties.go index 9a48a43b..a25c329c 100644 --- a/internal/testgit/repo_properties.go +++ b/internal/testgit/repo_properties.go @@ -1,6 +1,6 @@ package testgit -import "codeberg.org/lindenii/furgit/oid" +import "codeberg.org/lindenii/furgit/objectid" // Dir returns the repository directory path. func (repo *TestRepo) Dir() string { @@ -8,6 +8,6 @@ func (repo *TestRepo) Dir() string { } // Algorithm returns the object ID algorithm configured for this repository. -func (repo *TestRepo) Algorithm() oid.Algorithm { +func (repo *TestRepo) Algorithm() objectid.Algorithm { return repo.algo } diff --git a/internal/testgit/repo_rev_parse.go b/internal/testgit/repo_rev_parse.go index 7c3365a1..d545f97b 100644 --- a/internal/testgit/repo_rev_parse.go +++ b/internal/testgit/repo_rev_parse.go @@ -3,14 +3,14 @@ package testgit import ( "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // RevParse resolves rev expressions to object IDs. -func (repo *TestRepo) RevParse(tb testing.TB, spec string) oid.ObjectID { +func (repo *TestRepo) RevParse(tb testing.TB, spec string) objectid.ObjectID { tb.Helper() hex := repo.Run(tb, "rev-parse", spec) - id, err := oid.ParseHex(repo.algo, hex) + id, err := objectid.ParseHex(repo.algo, hex) if err != nil { tb.Fatalf("parse rev-parse output %q: %v", hex, err) } diff --git a/internal/testgit/repo_tag_annotated.go b/internal/testgit/repo_tag_annotated.go index 167aaa96..3db6cee9 100644 --- a/internal/testgit/repo_tag_annotated.go +++ b/internal/testgit/repo_tag_annotated.go @@ -4,11 +4,11 @@ import ( "fmt" "testing" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // TagAnnotated creates an annotated tag object and returns the resulting tag object ID. -func (repo *TestRepo) TagAnnotated(tb testing.TB, name string, target oid.ObjectID, message string) oid.ObjectID { +func (repo *TestRepo) TagAnnotated(tb testing.TB, name string, target objectid.ObjectID, message string) objectid.ObjectID { tb.Helper() repo.Run(tb, "tag", "-a", name, target.String(), "-m", message) return repo.RevParse(tb, fmt.Sprintf("refs/tags/%s", name)) |
