Skip to content

Commit b2dfdb3

Browse files
committed
HistorySize.Contents(): new method
Extract a new method from HistorySize.TableString().
1 parent 43a8a18 commit b2dfdb3

File tree

1 file changed

+76
-72
lines changed

1 file changed

+76
-72
lines changed

sizes/output.go

Lines changed: 76 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -323,78 +323,8 @@ type table struct {
323323
}
324324

325325
func (s HistorySize) TableString(threshold Threshold, nameStyle NameStyle) string {
326-
S := newSection
327-
I := newItem
328-
metric := counts.MetricPrefixes
329-
binary := counts.BinaryPrefixes
330-
t := &table{
331-
contents: S(
332-
"",
333-
S(
334-
"Overall repository size",
335-
S(
336-
"Commits",
337-
I("Count", nil, s.UniqueCommitCount, metric, " ", 500e3),
338-
I("Total size", nil, s.UniqueCommitSize, binary, "B", 250e6),
339-
),
340-
341-
S(
342-
"Trees",
343-
I("Count", nil, s.UniqueTreeCount, metric, " ", 1.5e6),
344-
I("Total size", nil, s.UniqueTreeSize, binary, "B", 2e9),
345-
I("Total tree entries", nil, s.UniqueTreeEntries, metric, " ", 50e6),
346-
),
347-
348-
S(
349-
"Blobs",
350-
I("Count", nil, s.UniqueBlobCount, metric, " ", 1.5e6),
351-
I("Total size", nil, s.UniqueBlobSize, binary, "B", 10e9),
352-
),
353-
354-
S(
355-
"Annotated tags",
356-
I("Count", nil, s.UniqueTagCount, metric, " ", 25e3),
357-
),
358-
359-
S(
360-
"References",
361-
I("Count", nil, s.ReferenceCount, metric, " ", 25e3),
362-
),
363-
),
364-
365-
S("Biggest objects",
366-
S("Commits",
367-
I("Maximum size", s.MaxCommitSizeCommit, s.MaxCommitSize, binary, "B", 50e3),
368-
I("Maximum parents", s.MaxParentCountCommit, s.MaxParentCount, metric, " ", 10),
369-
),
370-
371-
S("Trees",
372-
I("Maximum entries", s.MaxTreeEntriesTree, s.MaxTreeEntries, metric, " ", 1000),
373-
),
374-
375-
S("Blobs",
376-
I("Maximum size", s.MaxBlobSizeBlob, s.MaxBlobSize, binary, "B", 10e6),
377-
),
378-
),
379-
380-
S("History structure",
381-
I("Maximum history depth", nil, s.MaxHistoryDepth, metric, " ", 500e3),
382-
I("Maximum tag depth", s.MaxTagDepthTag, s.MaxTagDepth, metric, " ", 1.001),
383-
),
384-
385-
S("Biggest checkouts",
386-
I("Number of directories", s.MaxExpandedTreeCountTree, s.MaxExpandedTreeCount, metric, " ", 2000),
387-
I("Maximum path depth", s.MaxPathDepthTree, s.MaxPathDepth, metric, " ", 10),
388-
I("Maximum path length", s.MaxPathLengthTree, s.MaxPathLength, binary, "B", 100),
389-
390-
I("Number of files", s.MaxExpandedBlobCountTree, s.MaxExpandedBlobCount, metric, " ", 50e3),
391-
I("Total size of files", s.MaxExpandedBlobSizeTree, s.MaxExpandedBlobSize, binary, "B", 1e9),
392-
393-
I("Number of symlinks", s.MaxExpandedLinkCountTree, s.MaxExpandedLinkCount, metric, " ", 25e3),
394-
395-
I("Number of submodules", s.MaxExpandedSubmoduleCountTree, s.MaxExpandedSubmoduleCount, metric, " ", 100),
396-
),
397-
),
326+
t := table{
327+
contents: s.Contents(),
398328
threshold: threshold,
399329
nameStyle: nameStyle,
400330
footnotes: NewFootnotes(),
@@ -447,3 +377,77 @@ func (t *table) formatRow(
447377
prefix, name, spacer, citation, valueString, unitString, levelOfConcern,
448378
)
449379
}
380+
381+
func (s HistorySize) Contents() tableContents {
382+
S := newSection
383+
I := newItem
384+
metric := counts.MetricPrefixes
385+
binary := counts.BinaryPrefixes
386+
return S(
387+
"",
388+
S(
389+
"Overall repository size",
390+
S(
391+
"Commits",
392+
I("Count", nil, s.UniqueCommitCount, metric, " ", 500e3),
393+
I("Total size", nil, s.UniqueCommitSize, binary, "B", 250e6),
394+
),
395+
396+
S(
397+
"Trees",
398+
I("Count", nil, s.UniqueTreeCount, metric, " ", 1.5e6),
399+
I("Total size", nil, s.UniqueTreeSize, binary, "B", 2e9),
400+
I("Total tree entries", nil, s.UniqueTreeEntries, metric, " ", 50e6),
401+
),
402+
403+
S(
404+
"Blobs",
405+
I("Count", nil, s.UniqueBlobCount, metric, " ", 1.5e6),
406+
I("Total size", nil, s.UniqueBlobSize, binary, "B", 10e9),
407+
),
408+
409+
S(
410+
"Annotated tags",
411+
I("Count", nil, s.UniqueTagCount, metric, " ", 25e3),
412+
),
413+
414+
S(
415+
"References",
416+
I("Count", nil, s.ReferenceCount, metric, " ", 25e3),
417+
),
418+
),
419+
420+
S("Biggest objects",
421+
S("Commits",
422+
I("Maximum size", s.MaxCommitSizeCommit, s.MaxCommitSize, binary, "B", 50e3),
423+
I("Maximum parents", s.MaxParentCountCommit, s.MaxParentCount, metric, " ", 10),
424+
),
425+
426+
S("Trees",
427+
I("Maximum entries", s.MaxTreeEntriesTree, s.MaxTreeEntries, metric, " ", 1000),
428+
),
429+
430+
S("Blobs",
431+
I("Maximum size", s.MaxBlobSizeBlob, s.MaxBlobSize, binary, "B", 10e6),
432+
),
433+
),
434+
435+
S("History structure",
436+
I("Maximum history depth", nil, s.MaxHistoryDepth, metric, " ", 500e3),
437+
I("Maximum tag depth", s.MaxTagDepthTag, s.MaxTagDepth, metric, " ", 1.001),
438+
),
439+
440+
S("Biggest checkouts",
441+
I("Number of directories", s.MaxExpandedTreeCountTree, s.MaxExpandedTreeCount, metric, " ", 2000),
442+
I("Maximum path depth", s.MaxPathDepthTree, s.MaxPathDepth, metric, " ", 10),
443+
I("Maximum path length", s.MaxPathLengthTree, s.MaxPathLength, binary, "B", 100),
444+
445+
I("Number of files", s.MaxExpandedBlobCountTree, s.MaxExpandedBlobCount, metric, " ", 50e3),
446+
I("Total size of files", s.MaxExpandedBlobSizeTree, s.MaxExpandedBlobSize, binary, "B", 1e9),
447+
448+
I("Number of symlinks", s.MaxExpandedLinkCountTree, s.MaxExpandedLinkCount, metric, " ", 25e3),
449+
450+
I("Number of submodules", s.MaxExpandedSubmoduleCountTree, s.MaxExpandedSubmoduleCount, metric, " ", 100),
451+
),
452+
)
453+
}

0 commit comments

Comments
 (0)