Skip to content

Conversation

@estib-vega
Copy link
Contributor

@estib-vega estib-vega commented Nov 11, 2025

  • Surface headSha in ChangeForFrontend payloads for git activity and update frontend listeners to handle head and mode updates.
  • Update stacks and stack details when the git SHA that HEAD points to changes.

This is part 2 of 2 in a stack made with GitButler:

@vercel
Copy link

vercel bot commented Nov 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Ignored Ignored Preview Nov 11, 2025 8:04am

@github-actions github-actions bot added rust Pull requests that update Rust code @gitbutler/desktop labels Nov 11, 2025
Comment on lines +217 to +226
const headResponse = $derived(modeService.head(projectId));
const head = $derived(headResponse.response);
// If the head changes, invalidate stacks and details
$effect(() => {
if (head) {
stackService.invalidateStacksAndDetails();
}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mtsgrd Let's maybe talk about this?
This is the approach to updating the frontend based on the workspace SHA and not the DB updates

Include the current HEAD commit SHA with GitActivity events emitted by the
watcher and propagate it through the API and frontend plumbing.

- Change GitActivity from a single ProjectId variant to a struct with
  project_id and head_sha so consumers can know the exact HEAD commit.
- When logs/HEAD changes, read the repository HEAD and peel to the commit
  to obtain the SHA, then emit GitActivity with head_sha.
- Surface head SHA to the frontend: include headSha in the ChangeForFrontend
  payload for git activity.
- Add gix and gitbutler-oxidize workspace deps used to access repository
  information.
- Expose head_sha API command and related response types; extend the
  existing operating_mode command to return head (shorthand) along with
  operating mode.
- Wire the new head_sha command into the server RPC dispatch and tauri
  command list.

This allows the UI and other consumers to reliably identify the current
commit when git activity updates occur.
Update the way that the FE listens for the head and mode updates.
Additionally, listen for changes in the git SHA that the head points to, updating the stacks and stack details alongside
@estib-vega estib-vega force-pushed the update-stacks-on-head-change branch from 34e51e0 to 0fe5e21 Compare November 11, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@gitbutler/desktop rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants