commit 94470940c0bd80b70cc7f976f789a6aa6d80cc50
parent 5aef3c6a3c542fe93f05175cd1844ae8daf3dc31
Author: Erik Loualiche <[email protected]>
Date: Sun, 1 Mar 2026 17:31:57 -0600
fix: use transferred size instead of total source tree size
extractStats was matching "Total file size:" which reports the entire
source tree, not just transferred bytes. Changed to match
"Total transferred file size:" for accurate size display.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/internal/syncer/syncer.go b/internal/syncer/syncer.go
@@ -408,8 +408,9 @@ func (s *Syncer) extractStats(output string) (int, int64) {
}
}
- // Match "Total file size: 5,678 bytes"
- reBytes := regexp.MustCompile(`Total file size:\s*([\d,]+)`)
+ // Match "Total transferred file size: 5,678 bytes" (actual bytes sent,
+ // not the total source tree size reported by "Total file size:")
+ reBytes := regexp.MustCompile(`Total transferred file size:\s*([\d,]+)`)
if m := reBytes.FindStringSubmatch(output); len(m) > 1 {
cleaned := strings.ReplaceAll(m[1], ",", "")
if n, err := strconv.ParseInt(cleaned, 10, 64); err == nil {
diff --git a/internal/syncer/syncer_test.go b/internal/syncer/syncer_test.go
@@ -250,7 +250,8 @@ src/main.go
Number of files: 10
Number of regular files transferred: 3
-Total file size: 5,678 bytes
+Total file size: 99,999 bytes
+Total transferred file size: 5,678 bytes
sent 1,234 bytes received 56 bytes 2,580.00 bytes/sec
total size is 5,678 speedup is 4.40
`