Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase -i: reword empty commit after fast-forward
When rebasing git tries to reuse existing commits by fast-forwarding if the parents are unchanged. Rewording an empty commit that has been fast-forwarded fails because "git commit --amend" is called without "--allow-empty". This happens because when a commit is fast-forwarded the logic that checks whether we should pass "--allow-empty" is skipped. Fix this by always passing "--allow-empty" when rewording a commit. This is safe when we fast-forward because we know that the commit cannot have become empty due to the rebase as we are reusing an existing commit object. It is also safe when we do not fast-forward because the call to run_git_commit() that created the commit we're rewording would have failed if the commit had become empty. As "git commit" will happily create empty merge commits without "--allow-empty" we do not need to pass that flag when rewording merge commits. Signed-off-by: Phillip Wood <[email protected]>
- Loading branch information