Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions crates/git_ui/src/git_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4737,15 +4737,13 @@ impl GitPanel {
]
};

// Keep Staged/Unstaged headers pinned even when empty (as long as there's
// anything to show at all) so the layout stays stable while staging.
// Keep the Unstaged section pinned even when empty (as long as there's
// anything to show at all) so it never disappears mid-staging workflow.
let has_any_section_entries = section_entries
.iter()
.any(|(_, entries)| !entries.is_empty());
let show_when_empty = |section: Section| {
group_by_staging_state
&& has_any_section_entries
&& matches!(section, Section::Staged | Section::Unstaged)
group_by_staging_state && has_any_section_entries && section == Section::Unstaged
};

match &mut self.view_mode {
Expand Down Expand Up @@ -9986,10 +9984,6 @@ mod tests {
status: FileStatus::Unmerged(..),
..
}),
Header(GitHeaderEntry {
header: Section::Staged
}),
EmptySection(Section::Staged),
Header(GitHeaderEntry {
header: Section::Unstaged
}),
Expand Down Expand Up @@ -10020,10 +10014,6 @@ mod tests {
status: FileStatus::Unmerged(..),
..
}),
Header(GitHeaderEntry {
header: Section::Staged
}),
EmptySection(Section::Staged),
Header(GitHeaderEntry {
header: Section::Unstaged
}),
Expand Down
Loading