43485a6935f4

show total lines added and removed below save details (3.8.1)

time
2026-10-06 20:53 UTC · 6 days ago
machine
Junes-MacBook-Pro.local
agent
gpt-6
session
show save line totals
parent
9bc2e49df9b6
4 files VERSION+1 −1src/view/view.v+6 −0src/view/view_test.v+20 −1v.mod+1 −1
VERSION+1 −1
@@ -1 +1 @@1-3.8.01+3.8.1

view file

src/view/view.v+6 −0
@@ -608,9 +608,15 @@608608 		return lines609609 	}610610 	lines << '  ${deltas.len} files changed'611+	mut totals := snapshot.Delta{}611612 	for delta in deltas {612613 		lines << '  ${change_mark(delta)} ${delta.path}  ${line_stats(delta)}'614+		if !delta.binary {615+			totals.added += delta.added616+			totals.removed += delta.removed617+		}613618 	}619+	lines << ['', '  total  ${line_stats(totals)}']614620 	return lines615621 }616622 

view file

src/view/view_test.v+20 −1
@@ -253,13 +253,32 @@253253 			kind:   'added'254254 			binary: true255255 		},256+		snapshot.Delta{257+			path:  'new.txt'258+			kind:  'added'259+			added: 3260+		},261+		snapshot.Delta{262+			path:    'old.txt'263+			kind:    'removed'264+			removed: 5265+		},256266 	]257267 	text := plain(detail_lines(target, '', deltas, flag)).join('\n')258268 	assert text.contains('checksum aaa')259269 	assert text.contains('flag     sketchy')260270 	assert text.contains('M src/main.v  +4  -2')261271 	assert text.contains('A logo.png  (binary)')262-	assert text.contains('2 files changed')272+	assert text.contains('4 files changed')273+	assert text.ends_with('\n\n  total  +7  -7')274+}275+276+fn test_detail_of_an_unchanged_checkpoint_shows_zero_line_totals() {277+	mut target := save('aaa', 'checkpoint', true)278+	target.parent = 'ppp'279+	text := plain(detail_lines(target, '', [], events.Flag{})).join('\n')280+	assert text.contains('0 files changed')281+	assert text.ends_with('\n\n  total  +0  -0')263282 }264283 265284 fn test_detail_of_the_first_save_says_there_is_no_parent() {

view file

v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 	name: 'koh3'3-	version: '3.8.0'3+	version: '3.8.1'44 	description: 'One SQLite file per repo, one line of history.'55 	license: 'MIT'66 }

view file