[PR #13457] fix: use binary prefixes (1024) for file size display #60915

Open
opened 2026-04-29 16:01:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13457
Author: @nathannewyen
Created: 12/13/2025
Status: 🔄 Open

Base: mainHead: fix/ls-size-rounding


📝 Commits (1)

  • 932dbb5 fix: use binary prefixes (1024) for file size display

📊 Changes

3 files changed (+36 additions, -33 deletions)

View changed files

📝 cmd/cmd_test.go (+5 -5)
📝 format/bytes.go (+9 -8)
📝 format/bytes_test.go (+22 -20)

📄 Description

Summary

  • Changes HumanBytes to use binary prefixes (1024) instead of decimal prefixes (1000)
  • Aligns with standard computing conventions used by Hugging Face and most file systems

Changes

  • format/bytes.go: Use KibiByte, MebiByte, GibiByte (1024-based) instead of KiloByte, MegaByte, GigaByte (1000-based)
  • format/bytes_test.go: Update test cases to use binary values

Before/After

Bytes Before After
3072 3.1 KB 3 KB
4096 4.1 KB 4 KB
1048576 1 MB 1 MB

Test Plan

  • go test ./format/... passes

Fixes #13405


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13457 **Author:** [@nathannewyen](https://github.com/nathannewyen) **Created:** 12/13/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/ls-size-rounding` --- ### 📝 Commits (1) - [`932dbb5`](https://github.com/ollama/ollama/commit/932dbb54c57007370bc1da90fbc583f26b424c71) fix: use binary prefixes (1024) for file size display ### 📊 Changes **3 files changed** (+36 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd_test.go` (+5 -5) 📝 `format/bytes.go` (+9 -8) 📝 `format/bytes_test.go` (+22 -20) </details> ### 📄 Description ## Summary - Changes `HumanBytes` to use binary prefixes (1024) instead of decimal prefixes (1000) - Aligns with standard computing conventions used by Hugging Face and most file systems ## Changes - `format/bytes.go`: Use `KibiByte`, `MebiByte`, `GibiByte` (1024-based) instead of `KiloByte`, `MegaByte`, `GigaByte` (1000-based) - `format/bytes_test.go`: Update test cases to use binary values ## Before/After | Bytes | Before | After | |-------|--------|-------| | 3072 | 3.1 KB | 3 KB | | 4096 | 4.1 KB | 4 KB | | 1048576 | 1 MB | 1 MB | ## Test Plan - [x] `go test ./format/...` passes Fixes #13405 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 16:01:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#60915