File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,9 +67,17 @@ impl GitInfo {
6767 let status = git_command ( & root, & [ "status" , "--porcelain" ] ) . unwrap_or_default ( ) ;
6868 let is_dirty = !status. is_empty ( ) ;
6969
70- // Count changes
71- let changes = status. lines ( ) . filter ( |l| !l. starts_with ( "??" ) ) . count ( ) as u32 ;
72- let untracked = status. lines ( ) . filter ( |l| l. starts_with ( "??" ) ) . count ( ) as u32 ;
70+ // Count changes (saturating to u32::MAX to prevent truncation)
71+ let changes = status
72+ . lines ( )
73+ . filter ( |l| !l. starts_with ( "??" ) )
74+ . count ( )
75+ . min ( u32:: MAX as usize ) as u32 ;
76+ let untracked = status
77+ . lines ( )
78+ . filter ( |l| l. starts_with ( "??" ) )
79+ . count ( )
80+ . min ( u32:: MAX as usize ) as u32 ;
7381
7482 // Get tags
7583 let tags = git_command ( & root, & [ "tag" , "--points-at" , "HEAD" ] )
@@ -385,7 +393,7 @@ impl GitStash {
385393 let message = parts. get ( 2 ) . unwrap_or ( & "" ) . to_string ( ) ;
386394
387395 stashes. push ( GitStash {
388- index : i as u32 ,
396+ index : i. min ( u32 :: MAX as usize ) as u32 ,
389397 message,
390398 branch,
391399 } ) ;
You can’t perform that action at this time.
0 commit comments