From cdc65f9e8de256918af833aaee97588861fd6aa5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 7 Jun 2026 06:01:13 +0000 Subject: *: Refactor file granularity --- object/blob/blob.go | 7 ++----- object/blob/doc.go | 4 ++++ object/commit/commit.go | 6 ++++++ object/commit/extraheader.go | 7 ------- object/signature/signature.go | 9 +++++++++ object/signature/when.go | 10 ---------- 6 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 object/blob/doc.go delete mode 100644 object/commit/extraheader.go delete mode 100644 object/signature/when.go (limited to 'object') diff --git a/object/blob/blob.go b/object/blob/blob.go index 4ba132d1..793935fe 100644 --- a/object/blob/blob.go +++ b/object/blob/blob.go @@ -1,13 +1,10 @@ -// Package blob provides -// representations, parsers, and serializers -// for blob objects. package blob // Blob represents a Git blob object. // // Blob is fully materialized in memory. -// Consider using objectstore.Reader.ReadReaderContent, -// or appropriate streaming write APIs. +// Consider using [lindenii.org/go/furgit/object/fetch] +// for streaming access, or appropriate streaming write APIs. // // Labels: MT-Unsafe. type Blob struct { diff --git a/object/blob/doc.go b/object/blob/doc.go new file mode 100644 index 00000000..8eea353e --- /dev/null +++ b/object/blob/doc.go @@ -0,0 +1,4 @@ +// Package blob provides +// representations, parsers, and serializers +// for blob objects. +package blob diff --git a/object/commit/commit.go b/object/commit/commit.go index f41366b7..6a89bce9 100644 --- a/object/commit/commit.go +++ b/object/commit/commit.go @@ -17,3 +17,9 @@ type Commit struct { ChangeID string ExtraHeaders []ExtraHeader } + +// ExtraHeader represents an extra header in a Git object. +type ExtraHeader struct { + Key string + Value []byte +} diff --git a/object/commit/extraheader.go b/object/commit/extraheader.go deleted file mode 100644 index 79d4f9cc..00000000 --- a/object/commit/extraheader.go +++ /dev/null @@ -1,7 +0,0 @@ -package commit - -// ExtraHeader represents an extra header in a Git object. -type ExtraHeader struct { - Key string - Value []byte -} diff --git a/object/signature/signature.go b/object/signature/signature.go index e9ec56c0..3d5b911f 100644 --- a/object/signature/signature.go +++ b/object/signature/signature.go @@ -1,5 +1,7 @@ package signature +import "time" + // Signature represents a Git signature (author/committer/tagger). // // Labels: MT-Unsafe. @@ -9,3 +11,10 @@ type Signature struct { WhenUnix int64 OffsetMinutes int32 } + +// When returns a time.Time with the signature's timezone offset. +func (signature Signature) When() time.Time { + loc := time.FixedZone("git", int(signature.OffsetMinutes)*60) + + return time.Unix(signature.WhenUnix, 0).In(loc) +} diff --git a/object/signature/when.go b/object/signature/when.go deleted file mode 100644 index 0a252f68..00000000 --- a/object/signature/when.go +++ /dev/null @@ -1,10 +0,0 @@ -package signature - -import "time" - -// When returns a time.Time with the signature's timezone offset. -func (signature Signature) When() time.Time { - loc := time.FixedZone("git", int(signature.OffsetMinutes)*60) - - return time.Unix(signature.WhenUnix, 0).In(loc) -} -- cgit v1.3.1-10-gc9f91