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

fix(amend): support amending merge commits #1073

Merged
merged 1 commit into from
Sep 25, 2023
Merged

fix(amend): support amending merge commits #1073

merged 1 commit into from
Sep 25, 2023

Conversation

arxanas
Copy link
Owner

@arxanas arxanas commented Sep 24, 2023

No description provided.

Previously, `Repo::get_paths_touched_by_commit` returned `None` if the commit was a merge commit, the idea being that a merge commit doesn't have a single correct "patch". However, no call-site cared about this interpretation, and all call-sites worked just as well or better with the new interpretation, where we return the union of all changed paths with respect to all parents. Usually, the impact is that the dehydrated commit is a slightly larger commit than normal.

`git amend` was failing when `HEAD` was a merge commit for this reason, since the "fast amend" path first dehydrated the current commit. Before this commit, git-branchless would panic; after this commit, it successfully amends the merge commit.

Note that the `--merge` option to `git amend` is unrelated: it deals with restacking and merging descendant commits after the amend has been carried out.
@arxanas arxanas merged commit 4a964fc into master Sep 25, 2023
13 checks passed
@arxanas arxanas deleted the arxanas/amend branch September 25, 2023 00:39
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.

1 participant