@@ -60,7 +60,7 @@ enum LogSearch {
6060 Results ( LogSearchResult ) ,
6161}
6262
63- ///
63+ /// Top-level revlog tab that ties together the commit list, details, and search.
6464pub struct Revlog {
6565 repo : RepoPathRef ,
6666 commit_details : CommitDetailsComponent ,
@@ -135,35 +135,10 @@ impl Revlog {
135135 self . list
136136 . refresh_extend_data ( self . git_log . extract_items ( ) ?) ;
137137
138- let ( slice, global_start) = self . list . get_loaded_slice ( ) ;
139- if !slice. is_empty ( ) {
140- let mut branch_tips = HashSet :: new ( ) ;
141- let mut head_id = None ;
142-
143- for ( id, branches) in self . list . local_branches ( ) {
144- branch_tips. insert ( * id) ;
145- if head_id. is_none ( )
146- && branches. iter ( ) . any ( |b| {
147- b. local_details ( )
148- . is_some_and ( |d| d. is_head )
149- } ) {
150- head_id = Some ( * id) ;
151- }
152- }
153- branch_tips
154- . extend ( self . list . remote_branches ( ) . keys ( ) ) ;
155-
156- let stashes = HashSet :: new ( ) ;
157-
158- if let Some ( rows) = self . git_log . get_graph_rows (
159- & slice,
160- global_start,
161- & branch_tips,
162- & stashes,
163- head_id. as_ref ( ) ,
164- ) {
165- self . list . set_graph_rows ( rows) ;
166- }
138+ if self . list . is_graph_visible ( )
139+ && !self . list . is_graph_ready ( )
140+ {
141+ self . update_graph_rows ( ) ;
167142 }
168143
169144 self . git_tags . request ( Duration :: from_secs ( 3 ) , false ) ?;
@@ -182,6 +157,47 @@ impl Revlog {
182157 Ok ( ( ) )
183158 }
184159
160+ /// Computes graph rows for the current commit window. Rows
161+ /// don't depend on the selection
162+ /// so its is skipped while
163+ /// [`CommitList::is_graph_ready`] holds the bag.
164+ fn update_graph_rows ( & mut self ) {
165+ let ( slice, global_start) = self . list . get_loaded_slice ( ) ;
166+ if slice. is_empty ( ) {
167+ return ;
168+ }
169+
170+ let head_id = self . list . local_branches ( ) . iter ( ) . find_map (
171+ |( id, branches) | {
172+ let has_head = branches. iter ( ) . any ( |branch| {
173+ branch. local_details ( ) . is_some_and ( |b| b. is_head )
174+ } ) ;
175+ has_head. then_some ( * id)
176+ } ,
177+ ) ;
178+
179+ let branch_tips: HashSet < _ > = self
180+ . list
181+ . local_branches ( )
182+ . keys ( )
183+ . chain ( self . list . remote_branches ( ) . keys ( ) )
184+ . copied ( )
185+ . collect ( ) ;
186+
187+ // TODO: include stashes (heh)
188+ let stashes = HashSet :: new ( ) ;
189+
190+ if let Some ( rows) = self . git_log . get_graph_rows (
191+ & slice,
192+ global_start,
193+ & branch_tips,
194+ & stashes,
195+ head_id. as_ref ( ) ,
196+ ) {
197+ self . list . set_graph_rows ( rows) ;
198+ }
199+ }
200+
185201 ///
186202 pub fn update_git (
187203 & mut self ,
0 commit comments