Clean up temporary verify_patch state after failure or interruption
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Problem
`tools/verify_patch.sh` creates a temporary branch and may start a `git am` operation, but cleanup is repeated only in selected failure paths. An interruption or unexpected command failure can leave the repository on the temporary branch, leave the branch behind, or leave an active `git am` state.
## Scope
Centralize cleanup in `tools/verify_patch.sh` so success, normal failure, unexpected failure, and interruption restore the repository consistently.
Cleanup should return to the original branch or ref, abort an in-progress `git am` when needed, and remove only the temporary verification branch.
## Completion criteria
- [ ] Normal success restores the original branch or ref and removes the temporary branch.
- [ ] Patch-application and verification failures perform the same cleanup.
- [ ] Interrupting the script after temporary branch creation does not leave an active `git am` state or verification branch.
- [ ] Cleanup is safe when invoked more than once.
- [ ] Tests use an isolated temporary Git repository and do not modify the developer's current repository.
Related: #638
Contributor guide
Research direction
Start with tools/verify_patch.sh and trace temporary branch creation, git am handling, failure paths, and interruption behavior. Use an isolated temporary Git repository for tests, covering success, verification or patch-application failure, interruption, repeated cleanup, branch restoration, and removal of only the temporary verification branch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, shell
- Domain
- testing, tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100