aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read/layerinfo.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-26 09:17:14 +0000
committerGravatar Runxi Yu2026-03-26 09:18:30 +0000
commit3e884f5f3d42cbc4874a04da31dde10314b0cfad (patch)
treef5e1e325fd1a2a0801791c054010213214475d80 /format/commitgraph/read/layerinfo.go
parentnetwork/receivepack: Rename from receivepack (diff)
signatureNo signature
format: Move commitgraph and packfile here
Diffstat (limited to 'format/commitgraph/read/layerinfo.go')
-rw-r--r--format/commitgraph/read/layerinfo.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/format/commitgraph/read/layerinfo.go b/format/commitgraph/read/layerinfo.go
new file mode 100644
index 00000000..83c4407d
--- /dev/null
+++ b/format/commitgraph/read/layerinfo.go
@@ -0,0 +1,23 @@
+package read
+
+// LayerInfo describes one loaded commit-graph layer.
+type LayerInfo struct {
+ Path string
+ BaseCount uint32
+ Commits uint32
+}
+
+// Layers returns loaded layer metadata in native chain order.
+func (reader *Reader) Layers() []LayerInfo {
+ out := make([]LayerInfo, 0, len(reader.layers))
+ for i := range reader.layers {
+ layer := reader.layers[i]
+ out = append(out, LayerInfo{
+ Path: layer.path,
+ BaseCount: layer.baseCount,
+ Commits: layer.numCommits,
+ })
+ }
+
+ return out
+}