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

Make jj squash <path> not rewrite unmatched commits #3602

Merged
merged 6 commits into from
May 1, 2024

Conversation

martinvonz
Copy link
Member

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

lib/src/rewrite.rs Outdated Show resolved Hide resolved
lib/src/rewrite.rs Outdated Show resolved Hide resolved
cli/src/commands/squash.rs Show resolved Hide resolved
We didn't have any tests with `jj squash` with multiple source commits
and no matching paths.
We already have two uses for this function and I think we're soon
going to have more.

The function record the old commit as abandoned with the new parents,
which is typically what you want. We could record it as abandoned with
the old parents instead but then we'd have to do an extra iteration to
find the parents when rebasing any children. It would also be
confusing if
`rewriter.set_parents(new_parents).record_abandoned_commit()` didn't
respect the new parents.
Before this patch, we would abandon the source commit if it became
empty after applying the reverse diff. This changes that condition to
the equivalent condition of the selected tree being the source
commit's original tree. This will help us rewrite the code to use
`transform_descendants()`.
This is just a little refactoring to prepare for using
`transform_descendants()`.
@martinvonz martinvonz merged commit 7093d5d into main May 1, 2024
16 checks passed
@martinvonz martinvonz deleted the push-xpztonuknpkq branch May 1, 2024 03:03
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