Skip to content

Commit a747d45

Browse files
committed
TableString(): introduce shorthand for prefix types
1 parent 16e1e39 commit a747d45

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

sizes/output.go

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -327,72 +327,74 @@ type table struct {
327327
func (s HistorySize) TableString(threshold Threshold, nameStyle NameStyle) string {
328328
S := newSection
329329
I := newItem
330+
metric := counts.MetricPrefixes
331+
binary := counts.BinaryPrefixes
330332
t := &table{
331333
contents: S(
332334
"",
333335
S(
334336
"Overall repository size",
335337
S(
336338
"Commits",
337-
I("Count", nil, s.UniqueCommitCount, counts.MetricPrefixes, " ", 500e3),
338-
I("Total size", nil, s.UniqueCommitSize, counts.BinaryPrefixes, "B", 250e6),
339+
I("Count", nil, s.UniqueCommitCount, metric, " ", 500e3),
340+
I("Total size", nil, s.UniqueCommitSize, binary, "B", 250e6),
339341
),
340342

341343
S(
342344
"Trees",
343-
I("Count", nil, s.UniqueTreeCount, counts.MetricPrefixes, " ", 1.5e6),
344-
I("Total size", nil, s.UniqueTreeSize, counts.BinaryPrefixes, "B", 2e9),
345-
I("Total tree entries", nil, s.UniqueTreeEntries, counts.MetricPrefixes, " ", 50e6),
345+
I("Count", nil, s.UniqueTreeCount, metric, " ", 1.5e6),
346+
I("Total size", nil, s.UniqueTreeSize, binary, "B", 2e9),
347+
I("Total tree entries", nil, s.UniqueTreeEntries, metric, " ", 50e6),
346348
),
347349

348350
S(
349351
"Blobs",
350-
I("Count", nil, s.UniqueBlobCount, counts.MetricPrefixes, " ", 1.5e6),
351-
I("Total size", nil, s.UniqueBlobSize, counts.BinaryPrefixes, "B", 10e9),
352+
I("Count", nil, s.UniqueBlobCount, metric, " ", 1.5e6),
353+
I("Total size", nil, s.UniqueBlobSize, binary, "B", 10e9),
352354
),
353355

354356
S(
355357
"Annotated tags",
356-
I("Count", nil, s.UniqueTagCount, counts.MetricPrefixes, " ", 25e3),
358+
I("Count", nil, s.UniqueTagCount, metric, " ", 25e3),
357359
),
358360

359361
S(
360362
"References",
361-
I("Count", nil, s.ReferenceCount, counts.MetricPrefixes, " ", 25e3),
363+
I("Count", nil, s.ReferenceCount, metric, " ", 25e3),
362364
),
363365
),
364366

365367
S("Biggest objects",
366368
S("Commits",
367-
I("Maximum size", s.MaxCommitSizeCommit, s.MaxCommitSize, counts.BinaryPrefixes, "B", 50e3),
368-
I("Maximum parents", s.MaxParentCountCommit, s.MaxParentCount, counts.MetricPrefixes, " ", 10),
369+
I("Maximum size", s.MaxCommitSizeCommit, s.MaxCommitSize, binary, "B", 50e3),
370+
I("Maximum parents", s.MaxParentCountCommit, s.MaxParentCount, metric, " ", 10),
369371
),
370372

371373
S("Trees",
372-
I("Maximum entries", s.MaxTreeEntriesTree, s.MaxTreeEntries, counts.MetricPrefixes, " ", 1000),
374+
I("Maximum entries", s.MaxTreeEntriesTree, s.MaxTreeEntries, metric, " ", 1000),
373375
),
374376

375377
S("Blobs",
376-
I("Maximum size", s.MaxBlobSizeBlob, s.MaxBlobSize, counts.BinaryPrefixes, "B", 10e6),
378+
I("Maximum size", s.MaxBlobSizeBlob, s.MaxBlobSize, binary, "B", 10e6),
377379
),
378380
),
379381

380382
S("History structure",
381-
I("Maximum history depth", nil, s.MaxHistoryDepth, counts.MetricPrefixes, " ", 500e3),
382-
I("Maximum tag depth", s.MaxTagDepthTag, s.MaxTagDepth, counts.MetricPrefixes, " ", 1.001),
383+
I("Maximum history depth", nil, s.MaxHistoryDepth, metric, " ", 500e3),
384+
I("Maximum tag depth", s.MaxTagDepthTag, s.MaxTagDepth, metric, " ", 1.001),
383385
),
384386

385387
S("Biggest checkouts",
386-
I("Number of directories", s.MaxExpandedTreeCountTree, s.MaxExpandedTreeCount, counts.MetricPrefixes, " ", 2000),
387-
I("Maximum path depth", s.MaxPathDepthTree, s.MaxPathDepth, counts.MetricPrefixes, " ", 10),
388-
I("Maximum path length", s.MaxPathLengthTree, s.MaxPathLength, counts.BinaryPrefixes, "B", 100),
388+
I("Number of directories", s.MaxExpandedTreeCountTree, s.MaxExpandedTreeCount, metric, " ", 2000),
389+
I("Maximum path depth", s.MaxPathDepthTree, s.MaxPathDepth, metric, " ", 10),
390+
I("Maximum path length", s.MaxPathLengthTree, s.MaxPathLength, binary, "B", 100),
389391

390-
I("Number of files", s.MaxExpandedBlobCountTree, s.MaxExpandedBlobCount, counts.MetricPrefixes, " ", 50e3),
391-
I("Total size of files", s.MaxExpandedBlobSizeTree, s.MaxExpandedBlobSize, counts.BinaryPrefixes, "B", 1e9),
392+
I("Number of files", s.MaxExpandedBlobCountTree, s.MaxExpandedBlobCount, metric, " ", 50e3),
393+
I("Total size of files", s.MaxExpandedBlobSizeTree, s.MaxExpandedBlobSize, binary, "B", 1e9),
392394

393-
I("Number of symlinks", s.MaxExpandedLinkCountTree, s.MaxExpandedLinkCount, counts.MetricPrefixes, " ", 25e3),
395+
I("Number of symlinks", s.MaxExpandedLinkCountTree, s.MaxExpandedLinkCount, metric, " ", 25e3),
394396

395-
I("Number of submodules", s.MaxExpandedSubmoduleCountTree, s.MaxExpandedSubmoduleCount, counts.MetricPrefixes, " ", 100),
397+
I("Number of submodules", s.MaxExpandedSubmoduleCountTree, s.MaxExpandedSubmoduleCount, metric, " ", 100),
396398
),
397399
),
398400
threshold: threshold,

0 commit comments

Comments
 (0)