[codex] fix stash pop index preservation#429
Merged
Merged
Conversation
Signed-off-by: Eli Ma <eli@patch.sh>
Signed-off-by: Eli Ma <eli@patch.sh>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes libra stash apply / pop to preserve the current index by default so restored tracked changes come back as unstaged working-tree edits (matching Git’s default behavior), and updates tests/docs to lock in the contract.
Changes:
- Stop rebuilding/saving the index from the merged stash tree during
apply_stash_commit(worktree-only restore by default). - Add regression tests covering unstaged-only, staged-only, and mixed tracked-file stash pop cases.
- Update stash/merge-autostash/compatibility documentation to describe the default index behavior and the deferred
--indexmode (plus a pnpm version bump forweb/).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/package.json | Updates the pinned pnpm package manager version for the web workspace. |
| tests/command/stash_test.rs | Adds status --short helper + new regression tests for default stash pop index behavior. |
| src/command/stash.rs | Changes stash apply/pop implementation to stop rebuilding the index and preserve it by default. |
| docs/development/tracing/sandbox.md | Adds comparative notes about ricccrd/dd to the macOS sandbox research baseline/analysis. |
| docs/development/commands/stash.md | Documents default worktree-only restore behavior and deferred --index. |
| docs/development/commands/merge.md | Updates merge autostash documentation to reflect the new default stash restore semantics. |
| docs/commands/stash.md | Updates user-facing stash docs to explain default worktree-only restore (unstaged results). |
| COMPATIBILITY.md | Updates the stash row to document default index preservation on apply/pop. |
Signed-off-by: Eli Ma <eli@patch.sh>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libra stash apply/pop, so restored tracked changes come back as unstaged working-tree edits.--indexmode.Root Cause
apply_stash_commitrestored the merged stash tree into the working tree and then rebuilt the index from that same tree. That staged restored stash content by default, diverging from Git defaultstash apply/popbehavior and making a laterlibra commitinclude the restored change before the user ranlibra add.Validation
LIBRA_SKIP_WEB_BUILD=1 cargo test --test command_test stash_pop_restores_ -- --nocaptureLIBRA_SKIP_WEB_BUILD=1 cargo test --test command_test stash_test -- --nocaptureLIBRA_SKIP_WEB_BUILD=1 cargo test --test command_test merge_autostash -- --nocapturecargo +nightly fmt --all --checkstash popnow leavesstatus --shortasM tracked.txt.