11use std:: { collections:: HashMap , path:: PathBuf , vec} ;
22
3+ use crate :: integration:: get_workspace_head;
34use crate :: {
45 conflicts:: RepoConflictsExt ,
56 file:: { virtual_hunks_into_virtual_files, VirtualBranchFile } ,
@@ -16,7 +17,6 @@ use gitbutler_command_context::CommandContext;
1617use gitbutler_diff:: { diff_files_into_hunks, GitHunk , Hunk , HunkHash } ;
1718use gitbutler_operating_modes:: assure_open_workspace_mode;
1819use gitbutler_project:: access:: WorktreeWritePermission ;
19- use gitbutler_repo:: RepositoryExt ;
2020use tracing:: instrument;
2121
2222/// Represents the uncommitted status of the applied virtual branches in the workspace.
@@ -52,11 +52,10 @@ pub fn get_applied_status_cached(
5252 . virtual_branches ( )
5353 . list_branches_in_workspace ( ) ?;
5454 let base_file_diffs = worktree_changes. map ( Ok ) . unwrap_or_else ( || {
55- // TODO(ST): this was `get_workspace_head()`, which is slow and ideally, we don't dynamically
56- // calculate which should already be 'fixed' - why do we have the integration branch
57- // if we can't assume it's in the right state? So ideally, we assure that the code
58- // that affects the integration branch also updates it?
59- let integration_commit_id = ctx. repository ( ) . head_commit ( ) ?. id ( ) ;
55+ // TODO(ST): Ideally, we can avoid calling `get_workspace_head()` as everyone who modifies
56+ // any of its inputs will update the intragration commit right away.
57+ // It's for another day though - right now the integration commit may be slightly stale.
58+ let integration_commit_id = get_workspace_head ( ctx) ?;
6059 gitbutler_diff:: workdir ( ctx. repository ( ) , & integration_commit_id. to_owned ( ) )
6160 . context ( "failed to diff workdir" )
6261 } ) ?;
0 commit comments