Skip to content

Fix git filter-branch rewriting wrong commits when --max-commits is used - #33

Open
akai-hana wants to merge 1 commit into
f:masterfrom
akai-hana:fix/commit-message-order-inversion
Open

Fix git filter-branch rewriting wrong commits when --max-commits is used#33
akai-hana wants to merge 1 commit into
f:masterfrom
akai-hana:fix/commit-message-order-inversion

Conversation

@akai-hana

Copy link
Copy Markdown

Currently, grec overwrites the commit messages in reverse order whenever a --max-commits is specified.

This comes down to git filter-branch being invoked with a bare HEAD revision, causing it to walk and rewrite the entire history from the root commit instead of just the commits actually processed. This is what results on a desync of the counter-based msg-filter script, so messages generated for recent commits were applied to the repo's oldest commits instead, in the complete reverse order.

This pull request adds getRewriteRange() to anchor the filter-branch invocation to <parent-of-oldest-processed-commit>..HEAD, keeping msg-filter invocations in sync with the processed commit list.

Currently, grec overwrites the commit messages in reverse order whenever a `--max-commits` is specified.

This comes down to `git filter-branch` being invoked with a bare HEAD revision, causing it to walk and rewrite the entire history from the root commit instead of just the commits actually processed. This is what results on a desync of the counter-based msg-filter script, so messages generated for recent commits were applied to the repo's oldest commits instead, in the complete reverse order.

This pull request adds `getRewriteRange()` to anchor the filter-branch invocation to `<parent-of-oldest-processed-commit>..HEAD`, keeping msg-filter invocations in sync with the processed commit list.
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