Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@altsem
Copy link
Owner

@altsem altsem commented Apr 22, 2025

aims to enable: #350, and simplify the already existing use-cases.

TODO:

  • Tests aren't passing
  • Make it prettier? There's a bit much shared logic between the update/prompt fns

@codecov
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 91.74528% with 35 lines in your changes missing coverage. Please review.

Project coverage is 88.47%. Comparing base (740a86f) to head (05bdbce).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/state.rs 85.34% 17 Missing ⚠️
src/lib.rs 0.00% 11 Missing ⚠️
src/term.rs 84.00% 4 Missing ⚠️
src/error.rs 0.00% 2 Missing ⚠️
src/tests/helpers/ui.rs 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #356      +/-   ##
==========================================
+ Coverage   87.50%   88.47%   +0.97%     
==========================================
  Files          66       66              
  Lines        6537     6585      +48     
==========================================
+ Hits         5720     5826     +106     
+ Misses        817      759      -58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@altsem altsem changed the title refactor: add new state.prompt() function (WIP) refactor: add new state.prompt() function and improve event handling Apr 30, 2025
@altsem altsem changed the title refactor: add new state.prompt() function and improve event handling refactor: add new state.prompt() function and simplify event handling Apr 30, 2025
@altsem altsem requested a review from Copilot April 30, 2025 22:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This refactor introduces a new synchronous state.prompt() function and simplifies event handling throughout the codebase. Key changes include replacing callback‐based prompt logic with a synchronous prompt call, refactoring event handling to remove the GituEvent abstraction, and updating multiple ops to use the new prompt and confirmation APIs.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tests/commit.rs Updates function calls to use the new update API
src/term.rs Adjusts the Test backend structure and adds poll_event/read_event methods
src/state.rs Refactors event loop and prompt handling, adds new functions (prompt, confirm, etc.)
src/prompt.rs Removes the outdated on_success callback from PromptData
src/ops/* Updates prompt usage across various git operations
src/lib.rs Removes unused GituEvent and simplifies run logic
Comments suppressed due to low confidence (1)

src/term.rs:171

  • Consider returning Ok(false) instead of an error when no events are available in the Test backend. This would align its behavior with the Crossterm branch and simplify handling in test scenarios.
TermBackend::Test { events, .. } => { if events.is_empty() { Err(Error::NoMoreEvents) } else { Ok(true) } },

@altsem altsem marked this pull request as ready for review April 30, 2025 22:29
@altsem altsem merged commit e7b7719 into master Apr 30, 2025
5 checks passed
@altsem altsem deleted the refactor/prompt branch April 30, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants