diff options
| author | 2026-02-20 22:52:58 +0800 | |
|---|---|---|
| committer | 2026-02-20 22:52:58 +0800 | |
| commit | f49c95662bda1f2c337dbe872644afa1ca5cbbec (patch) | |
| tree | 502b399c86f0093b50ad5fc80b73f75f4c614733 /object | |
| parent | config: Import from the previous version and fix test harnesses (diff) | |
| signature | No signature | |
objectid: Rename from oid
Diffstat (limited to 'object')
| -rw-r--r-- | object/blob_parse_test.go | 4 | ||||
| -rw-r--r-- | object/blob_serialize_test.go | 4 | ||||
| -rw-r--r-- | object/commit.go | 6 | ||||
| -rw-r--r-- | object/commit_parse.go | 8 | ||||
| -rw-r--r-- | object/commit_parse_test.go | 4 | ||||
| -rw-r--r-- | object/commit_serialize_test.go | 4 | ||||
| -rw-r--r-- | object/parse.go | 6 | ||||
| -rw-r--r-- | object/tag.go | 4 | ||||
| -rw-r--r-- | object/tag_parse.go | 6 | ||||
| -rw-r--r-- | object/tag_parse_test.go | 4 | ||||
| -rw-r--r-- | object/tag_serialize_test.go | 4 | ||||
| -rw-r--r-- | object/tree.go | 4 | ||||
| -rw-r--r-- | object/tree_parse.go | 6 | ||||
| -rw-r--r-- | object/tree_parse_test.go | 4 | ||||
| -rw-r--r-- | object/tree_serialize_test.go | 4 |
15 files changed, 36 insertions, 36 deletions
diff --git a/object/blob_parse_test.go b/object/blob_parse_test.go index 02c059ca..ad0f7ef3 100644 --- a/object/blob_parse_test.go +++ b/object/blob_parse_test.go @@ -6,11 +6,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestBlobParseFromGit(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) body := []byte("hello\nblob\n") blobID := repo.HashObject(t, "blob", body) diff --git a/object/blob_serialize_test.go b/object/blob_serialize_test.go index 79fbc1b9..07811365 100644 --- a/object/blob_serialize_test.go +++ b/object/blob_serialize_test.go @@ -5,11 +5,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestBlobSerialize(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) body := []byte("hello\nblob\n") wantID := repo.HashObject(t, "blob", body) diff --git a/object/commit.go b/object/commit.go index 92b7fcdc..50d94057 100644 --- a/object/commit.go +++ b/object/commit.go @@ -2,13 +2,13 @@ package object import ( "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // Commit represents a Git commit object. type Commit struct { - Tree oid.ObjectID - Parents []oid.ObjectID + Tree objectid.ObjectID + Parents []objectid.ObjectID Author Ident Committer Ident Message []byte diff --git a/object/commit_parse.go b/object/commit_parse.go index 9693b4da..2d207add 100644 --- a/object/commit_parse.go +++ b/object/commit_parse.go @@ -5,11 +5,11 @@ import ( "errors" "fmt" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // ParseCommit decodes a commit object body. -func ParseCommit(body []byte, algo oid.Algorithm) (*Commit, error) { +func ParseCommit(body []byte, algo objectid.Algorithm) (*Commit, error) { c := new(Commit) i := 0 for i < len(body) { @@ -30,13 +30,13 @@ func ParseCommit(body []byte, algo oid.Algorithm) (*Commit, error) { switch string(key) { case "tree": - id, err := oid.ParseHex(algo, string(value)) + id, err := objectid.ParseHex(algo, string(value)) if err != nil { return nil, fmt.Errorf("object: commit: tree: %w", err) } c.Tree = id case "parent": - id, err := oid.ParseHex(algo, string(value)) + id, err := objectid.ParseHex(algo, string(value)) if err != nil { return nil, fmt.Errorf("object: commit: parent: %w", err) } diff --git a/object/commit_parse_test.go b/object/commit_parse_test.go index 8d1f192d..e1bfb3d1 100644 --- a/object/commit_parse_test.go +++ b/object/commit_parse_test.go @@ -6,11 +6,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestCommitParseFromGit(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) _, treeID, commitID := repo.MakeCommit(t, "subject\n\nbody") diff --git a/object/commit_serialize_test.go b/object/commit_serialize_test.go index 2061495d..5f4cf0cf 100644 --- a/object/commit_serialize_test.go +++ b/object/commit_serialize_test.go @@ -5,11 +5,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestCommitSerialize(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) _, _, commitID := repo.MakeCommit(t, "subject\n\nbody") diff --git a/object/parse.go b/object/parse.go index c87f2713..4ab37ae6 100644 --- a/object/parse.go +++ b/object/parse.go @@ -5,11 +5,11 @@ import ( "codeberg.org/lindenii/furgit/internal/objectheader" "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // ParseObjectWithoutHeader parses a typed object body. -func ParseObjectWithoutHeader(ty objecttype.Type, body []byte, algo oid.Algorithm) (Object, error) { +func ParseObjectWithoutHeader(ty objecttype.Type, body []byte, algo objectid.Algorithm) (Object, error) { switch ty { case objecttype.TypeBlob: return ParseBlob(body) @@ -25,7 +25,7 @@ func ParseObjectWithoutHeader(ty objecttype.Type, body []byte, algo oid.Algorith } // ParseObjectWithHeader parses a loose object in "type size\\x00body" format. -func ParseObjectWithHeader(raw []byte, algo oid.Algorithm) (Object, error) { +func ParseObjectWithHeader(raw []byte, algo objectid.Algorithm) (Object, error) { ty, size, headerLen, ok := objectheader.Parse(raw) if !ok { return nil, fmt.Errorf("object: malformed object header") diff --git a/object/tag.go b/object/tag.go index 4e150ba2..1fac845b 100644 --- a/object/tag.go +++ b/object/tag.go @@ -2,12 +2,12 @@ package object import ( "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // Tag represents a Git annotated tag object. type Tag struct { - Target oid.ObjectID + Target objectid.ObjectID TargetType objecttype.Type Name []byte Tagger *Ident diff --git a/object/tag_parse.go b/object/tag_parse.go index 27dc998d..c991404f 100644 --- a/object/tag_parse.go +++ b/object/tag_parse.go @@ -6,11 +6,11 @@ import ( "fmt" "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // ParseTag decodes a tag object body. -func ParseTag(body []byte, algo oid.Algorithm) (*Tag, error) { +func ParseTag(body []byte, algo objectid.Algorithm) (*Tag, error) { t := new(Tag) i := 0 var haveTarget, haveType bool @@ -33,7 +33,7 @@ func ParseTag(body []byte, algo oid.Algorithm) (*Tag, error) { switch string(key) { case "object": - id, err := oid.ParseHex(algo, string(value)) + id, err := objectid.ParseHex(algo, string(value)) if err != nil { return nil, fmt.Errorf("object: tag: object: %w", err) } diff --git a/object/tag_parse_test.go b/object/tag_parse_test.go index b8628bb3..84d29069 100644 --- a/object/tag_parse_test.go +++ b/object/tag_parse_test.go @@ -7,11 +7,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestTagParseFromGit(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + 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") diff --git a/object/tag_serialize_test.go b/object/tag_serialize_test.go index 4585bc16..435259b4 100644 --- a/object/tag_serialize_test.go +++ b/object/tag_serialize_test.go @@ -5,11 +5,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestTagSerialize(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + 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") diff --git a/object/tree.go b/object/tree.go index a28bfcc9..eae34c04 100644 --- a/object/tree.go +++ b/object/tree.go @@ -6,7 +6,7 @@ import ( "sort" "codeberg.org/lindenii/furgit/objecttype" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // FileMode represents the mode of a file in a Git tree. @@ -24,7 +24,7 @@ const ( type TreeEntry struct { Mode FileMode Name []byte - ID oid.ObjectID + ID objectid.ObjectID } // Tree represents a Git tree object. diff --git a/object/tree_parse.go b/object/tree_parse.go index b9063d75..37a2fa4b 100644 --- a/object/tree_parse.go +++ b/object/tree_parse.go @@ -5,11 +5,11 @@ import ( "fmt" "strconv" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) // ParseTree decodes a tree object body. -func ParseTree(body []byte, algo oid.Algorithm) (*Tree, error) { +func ParseTree(body []byte, algo objectid.Algorithm) (*Tree, error) { var entries []TreeEntry i := 0 for i < len(body) { @@ -31,7 +31,7 @@ func ParseTree(body []byte, algo oid.Algorithm) (*Tree, error) { if idEnd > len(body) { return nil, fmt.Errorf("object: tree: truncated child object id") } - id, err := oid.FromBytes(algo, body[i:idEnd]) + id, err := objectid.FromBytes(algo, body[i:idEnd]) if err != nil { return nil, err } diff --git a/object/tree_parse_test.go b/object/tree_parse_test.go index bbe7c69b..09c396e3 100644 --- a/object/tree_parse_test.go +++ b/object/tree_parse_test.go @@ -6,11 +6,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestTreeParseFromGit(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) entries := adversarialRootEntries(t, repo) inserted := &object.Tree{} diff --git a/object/tree_serialize_test.go b/object/tree_serialize_test.go index 59d09ea1..462eff9d 100644 --- a/object/tree_serialize_test.go +++ b/object/tree_serialize_test.go @@ -5,11 +5,11 @@ import ( "codeberg.org/lindenii/furgit/internal/testgit" "codeberg.org/lindenii/furgit/object" - "codeberg.org/lindenii/furgit/oid" + "codeberg.org/lindenii/furgit/objectid" ) func TestTreeSerialize(t *testing.T) { - testgit.ForEachAlgorithm(t, func(t *testing.T, algo oid.Algorithm) { + testgit.ForEachAlgorithm(t, func(t *testing.T, algo objectid.Algorithm) { repo := testgit.NewBareRepo(t, algo) entries := adversarialRootEntries(t, repo) tree := &object.Tree{} |
