Skip to content

Commit df305e4

Browse files
committed
manifest: include L0 files in output when L0Sublevels unpopulated
The L0Sublevels structure is populated at a different stage of version edit application. Avoid confusion by printing the L0 files as an unorganized if a Version's debug string is rendered during this stage.
1 parent 3792669 commit df305e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/manifest/version.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ func (v *Version) string(fmtKey base.FormatKey, verbose bool) string {
221221
var buf bytes.Buffer
222222
if len(v.L0SublevelFiles) > 0 {
223223
fmt.Fprintf(&buf, "%s", describeSublevels(fmtKey, verbose, v.L0SublevelFiles))
224+
} else if !v.Levels[0].Empty() {
225+
// Depending on where within the version lifecycle we're printing the
226+
// Version, we may not have the sublevels structure populated yet. If
227+
// L0SublevelFiles wasn't populated, print the L0 files without any L0
228+
// structure.
229+
fmt.Fprintf(&buf, "L0 (no sublevels yet):\n")
230+
for f := range v.Levels[0].All() {
231+
fmt.Fprintf(&buf, " %s\n", f.DebugString(fmtKey, verbose))
232+
}
224233
}
225234
for level := 1; level < NumLevels; level++ {
226235
if v.Levels[level].Empty() {

0 commit comments

Comments
 (0)