Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop running hooks in commit function #5894

Merged
merged 1 commit into from
Jan 14, 2025
Merged

Stop running hooks in commit function #5894

merged 1 commit into from
Jan 14, 2025

Conversation

mtsgrd
Copy link
Contributor

@mtsgrd mtsgrd commented Jan 6, 2025

  • will be orchestrated by client instead

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

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 8:39am
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 8:39am

message.to_owned()
};

if run_hooks {
Copy link
Member

Choose a reason for hiding this comment

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

I think you should make commit no longer run hooks here at all. Instead, having the hooks execution in a separate command, this way the UI can execute the two commands in sequence.
As I wrote in the other message before, the benefits would be:

  • better UX (we can show that hooks are being executed/spinner)
  • we can easily differentiate the errors
  • the test is more testable and less error prone because each command does less.
    Let's discuss tomorrow.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I love the idea to make the UI more aware of what's going on. Something I wonder though is if there is another way of doing it, one that doesn't force the UI to steer it. An idea was to stream progress information to the UI, but I don't think tauri supports that outside of events, so for the UI it would always be a separate stream of events coming in so the action at hand and additional streaming data (like progress) will always be separate. In the backend, this could probably be some sort of trait implementation that is passed around. With such a system, progress could be implemented, too.

Both ideas, separating commits from running hooks, and passing some trait object that allows for real-time metadata to get out of backend functions while they execute, are orthogonal and maybe both will help solve this problem better than they would alone.

I haven't arrived at a clear conclusion myself, but wanted to share my thoughts while at it.

Copy link
Member

Choose a reason for hiding this comment

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

I love the idea to make the UI more aware of what's going on. Something I wonder though is if there is another way of doing it, one that doesn't force the UI to steer it. An idea was to stream progress information to the UI, but I don't think tauri supports that outside of events, so for the UI it would always be a separate stream of events coming in so the action at hand and additional streaming data (like progress) will always be separate. In the backend, this could probably be some sort of trait implementation that is passed around. With such a system, progress could be implemented, too.

Both ideas, separating commits from running hooks, and passing some trait object that allows for real-time metadata to get out of backend functions while they execute, are orthogonal and maybe both will help solve this problem better than they would alone.

I haven't arrived at a clear conclusion myself, but wanted to share my thoughts while at it.

Another alternative could be to compose the two commands, this way the UI doesn't have to do it. But it feels like this may not be the correct separation since we want the UI to be aware of the two steps in this process

@krlvi
Copy link
Member

krlvi commented Jan 7, 2025

👨‍🔬 Meta comment on stacking / code collab /review 🔍

Interestingly, this time stacking makes the whole thing harder to review (e.g. the changes feel very much related with new code being introduced and then moved to a different file in another part of the stack).
Also our chat/messages become scattered between the stacked branches.

As a reviewer, I think would have been more ergonomic to have these as commits in one branch. And then I would likely look at the final diff instead of commit by commit...

@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 4ee4df0 to 140e4ff Compare January 7, 2025 09:44
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 140e4ff to 4309bd1 Compare January 7, 2025 09:57
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 4309bd1 to ee2d78b Compare January 7, 2025 10:54
Base automatically changed from fix-hooks to master January 7, 2025 11:41
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from ee2d78b to 51cf919 Compare January 7, 2025 12:07
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 06ebdc4 to fb5fd4b Compare January 10, 2025 01:10
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from fb5fd4b to b9a4012 Compare January 10, 2025 01:19
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from b9a4012 to 5a22bc8 Compare January 10, 2025 07:58
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 5a22bc8 to 3662989 Compare January 10, 2025 08:23
@mtsgrd mtsgrd requested a review from krlvi January 10, 2025 08:29
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 3662989 to 3bfec91 Compare January 13, 2025 09:41
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from 3bfec91 to f2cf6e4 Compare January 13, 2025 11:59
@mtsgrd mtsgrd force-pushed the use-index-with-hooks branch from fb55cbc to f2cf6e4 Compare January 13, 2025 22:47
- will be orchestrated by client instead
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.

3 participants