Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions app/src/context_chips/current_prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,16 @@ impl CurrentPrompt {
output: value.as_ref(),
timed_out,
});
// GitDiffStats has two value sources that can race when entering a repo:
// this shell fallback (`git diff --shortstat HEAD`, tracked changes only)
// and a repo-status watcher that also counts untracked files. If the
// watcher attached while this fallback was in flight, drop the fallback's
// result
if matches!(chip_kind, ContextChipKind::GitDiffStats)
&& me.is_updated_externally(&chip_kind)
{
return;
}
Comment on lines +776 to +785
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


if timed_out {
if suppress_on_failure
Expand Down Expand Up @@ -1431,6 +1441,16 @@ impl CurrentPrompt {
}
}

// Repo detached, clear GitDiffStats.
if handle.is_none() {
if let Some(state) = self.states.get_mut(&ContextChipKind::GitDiffStats) {
state.clear_abort_handlers();
state.clear_cache();
}
let _ = self.update_tx.try_send(());
return;
}

if let Some(weak) = handle {
if let Some(strong) = weak.upgrade(ctx) {
self.git_repo_status = Some(weak);
Expand Down
4 changes: 4 additions & 0 deletions app/src/terminal/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4813,6 +4813,10 @@ impl TerminalView {
self.input.update(ctx, |input, ctx| {
input.update_repo_path(None, ctx);
});
// Redraw on repo exit so the code review button drops its diff annotation immediately.
self.refresh_pane_header(ctx);
ctx.emit(Event::TerminalViewStateChanged);
ctx.notify();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me that we emit a TerminalViewStateChanged (since this updates the diff chip on the workspace header) and re-render the active terminal view - but a little confused at why we're refreshing the pane header? Is there any dependency between the pane header <> repo status?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the call out!

No need to refresh the pane header here, and also re-rendering the active terminal view is also redundant (set_git_repo_status already re-renders). Updated!

}

/// Helper to read metadata from the per-repo sub-model.
Expand Down
Loading