git_panel: Fix buffer header checkbox not showing partially staged files (#42718)

Release Notes:

- Fixed buffer header controls (staging checkbox) not showing partially
staged files
This commit is contained in:
Jakub Konka
2025-11-14 12:55:04 +00:00
committed by GitHub
parent b4167caaf1
commit 37523b0007
5 changed files with 30 additions and 40 deletions
+4 -7
View File
@@ -312,10 +312,7 @@ pub enum RepositoryState {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RepositoryEvent {
StatusesChanged {
// TODO could report which statuses changed here
full_scan: bool,
},
StatusesChanged,
MergeHeadsChanged,
BranchChanged,
StashEntriesChanged,
@@ -4989,7 +4986,7 @@ impl Repository {
)
.collect::<Vec<_>>();
if !edits.is_empty() {
cx.emit(RepositoryEvent::StatusesChanged { full_scan: true });
cx.emit(RepositoryEvent::StatusesChanged);
}
self.snapshot.statuses_by_path.edit(edits, ());
if update.is_last_update {
@@ -5343,7 +5340,7 @@ impl Repository {
}
if !changed_path_statuses.is_empty() {
cx.emit(RepositoryEvent::StatusesChanged { full_scan: false });
cx.emit(RepositoryEvent::StatusesChanged);
this.snapshot
.statuses_by_path
.edit(changed_path_statuses, ());
@@ -5725,7 +5722,7 @@ async fn compute_snapshot(
}
if statuses_by_path != prev_snapshot.statuses_by_path {
events.push(RepositoryEvent::StatusesChanged { full_scan: true })
events.push(RepositoryEvent::StatusesChanged)
}
// Useful when branch is None in detached head state
+1 -5
View File
@@ -63,11 +63,7 @@ impl BranchDiff {
window,
move |this, _git_store, event, _window, cx| match event {
GitStoreEvent::ActiveRepositoryChanged(_)
| GitStoreEvent::RepositoryUpdated(
_,
RepositoryEvent::StatusesChanged { full_scan: _ },
true,
)
| GitStoreEvent::RepositoryUpdated(_, RepositoryEvent::StatusesChanged, true)
| GitStoreEvent::ConflictsUpdated => {
cx.emit(BranchDiffEvent::FileListChanged);
*this.update_needed.borrow_mut() = ();
+3 -3
View File
@@ -9575,7 +9575,7 @@ async fn test_ignored_dirs_events(cx: &mut gpui::TestAppContext) {
assert_eq!(
repository_updates.lock().drain(..).collect::<Vec<_>>(),
vec![
RepositoryEvent::StatusesChanged { full_scan: true },
RepositoryEvent::StatusesChanged,
RepositoryEvent::MergeHeadsChanged,
],
"Initial worktree scan should produce a repo update event"
@@ -9743,8 +9743,8 @@ async fn test_odd_events_for_ignored_dirs(
vec![
RepositoryEvent::MergeHeadsChanged,
RepositoryEvent::BranchChanged,
RepositoryEvent::StatusesChanged { full_scan: false },
RepositoryEvent::StatusesChanged { full_scan: false },
RepositoryEvent::StatusesChanged,
RepositoryEvent::StatusesChanged,
],
"Initial worktree scan should produce a repo update event"
);