@@ -88,24 +88,25 @@ fn populate_branch_short_ids(
8888 . iter_mut ( )
8989 . flat_map ( |stack| stack. segments . iter_mut ( ) )
9090 {
91- let Some ( branch_name) = segment. branch_name ( ) else {
92- // The branch CliId is its name, so if this segment doesn't have a
93- // name, it doesn't need an ID.
94- continue ;
95- } ;
96- segment. short_id = ' short_id: {
97- // Find first non-conflicting pair or triple (i.e. used in
98- // exactly one branch) and use it.
99- for candidate in branch_name. windows ( 2 ) . chain ( branch_name. windows ( 3 ) ) {
100- if let Ok ( short_id) = str:: from_utf8 ( candidate)
101- && let Some ( true ) = maybe_mark_used ( candidate, id_usage)
102- {
103- break ' short_id short_id. to_owned ( ) ;
91+ if let Some ( branch_name) = segment. branch_name ( ) {
92+ segment. short_id = ' short_id: {
93+ // Find first non-conflicting pair or triple (i.e. used in
94+ // exactly one branch) and use it.
95+ for candidate in branch_name. windows ( 2 ) . chain ( branch_name. windows ( 3 ) ) {
96+ if let Ok ( short_id) = str:: from_utf8 ( candidate)
97+ && let Some ( true ) = maybe_mark_used ( candidate, id_usage)
98+ {
99+ break ' short_id short_id. to_owned ( ) ;
100+ }
104101 }
105- }
106- // If none available, use next available ID.
107- id_usage. next_available ( ) ?. to_short_id ( )
108- } ;
102+ // If none available, use next available ID.
103+ id_usage. next_available ( ) ?. to_short_id ( )
104+ } ;
105+ } else {
106+ // This sgement is anonymous, so we have no name to base the ID on. We just assign it a
107+ // generic ID, which allows some rudimentary stuff to work (e.g. `but status`).
108+ segment. short_id = id_usage. next_available ( ) ?. to_short_id ( ) ;
109+ }
109110 }
110111
111112 Ok ( ( ) )
0 commit comments