aboutsummaryrefslogtreecommitdiff
path: root/commitgraph/read/layerinfo.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-10 13:30:48 +0800
committerGravatar Runxi Yu2026-03-10 13:30:48 +0800
commit73e602a5c2c766caba59948e91c11122653705ec (patch)
tree57951a4275dd90c2b3953e5b4bf3c9a7bd09b84a /commitgraph/read/layerinfo.go
parent*: Move sideband64k and pktline to protocol/ (diff)
signatureNo signature
commitgraph: Move out of format/
Diffstat (limited to 'commitgraph/read/layerinfo.go')
-rw-r--r--commitgraph/read/layerinfo.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/commitgraph/read/layerinfo.go b/commitgraph/read/layerinfo.go
new file mode 100644
index 00000000..83c4407d
--- /dev/null
+++ b/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
+}