-
Notifications
You must be signed in to change notification settings - Fork 7.1k
fix(git): support staged-only ghost commits and fix seatbelt test #8421
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
base: main
Are you sure you want to change the base?
Conversation
This change introduces a 'staged_only' flag to CreateGhostCommitOptions. When enabled, it creates a ghost commit reflecting only the files currently staged in the git index, rather than all worktree changes. This addresses Issue openai#8404 where reviews were incorrectly including unstaged changes. Also includes a fix for a flaky seatbelt test in codex-core.
|
@Galaxy-0, thanks for the contribution. Please remove the flaky test fix. We prefer not to combine unrelated changes into a single commit. If you'd like to submit a separate PR for the flaky test fix, that's OK. |
|
Also, I don't see any tests for the new functionality. |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61d178a065
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !force_include.is_empty() { | ||
| let mut args = Vec::with_capacity(force_include.len() + 2); | ||
| args.push(OsString::from("add")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid re-staging force-includes in staged-only snapshots
When staged_only is enabled, the temp index is copied from the real index above, but this block always runs git add --force on force_include paths, which re-reads those files from the working tree. If any forced path has unstaged edits (e.g. an ignored config file changed after staging), those unstaged contents will be pulled into the ghost commit, defeating the “staged-only” guarantee that motivated this change. Consider skipping this block in staged-only mode or only adding force-included paths that are already staged in the real index.
Useful? React with 👍 / 👎.
|
Also, please take a look at the codex code review comment. |
Fixes #8404
Description
This PR addresses Issue #8404 where code reviews incorrectly included unstaged working directory changes.
Changes
staged_onlyoption toCreateGhostCommitOptionsinghost_commits.rs.create_ghost_commit_with_reportto supportstaged_only:codex-core/src/seatbelt.rsrelated to bash output assertions.Verification
codex-git.