1
1
use std:: { collections:: HashMap , path:: PathBuf , vec} ;
2
2
3
+ use crate :: integration:: get_workspace_head;
3
4
use crate :: {
4
5
conflicts:: RepoConflictsExt ,
5
6
file:: { virtual_hunks_into_virtual_files, VirtualBranchFile } ,
@@ -16,7 +17,6 @@ use gitbutler_command_context::CommandContext;
16
17
use gitbutler_diff:: { diff_files_into_hunks, GitHunk , Hunk , HunkHash } ;
17
18
use gitbutler_operating_modes:: assure_open_workspace_mode;
18
19
use gitbutler_project:: access:: WorktreeWritePermission ;
19
- use gitbutler_repo:: RepositoryExt ;
20
20
use tracing:: instrument;
21
21
22
22
/// Represents the uncommitted status of the applied virtual branches in the workspace.
@@ -52,11 +52,10 @@ pub fn get_applied_status_cached(
52
52
. virtual_branches ( )
53
53
. list_branches_in_workspace ( ) ?;
54
54
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) ?;
60
59
gitbutler_diff:: workdir ( ctx. repository ( ) , & integration_commit_id. to_owned ( ) )
61
60
. context ( "failed to diff workdir" )
62
61
} ) ?;
0 commit comments