fix: preserve migration order when files are moved to a new directory#22
Merged
mergify[bot] merged 1 commit intoMar 31, 2026
Conversation
When all migrations are moved to a new directory in a single commit, `git log --diff-filter=A` with a pathspec restricted to the new directory only sees the move commit as the one that "added" the files. Within that single commit, git outputs filenames alphabetically, losing the original chronological add order. Fix by removing the pathspec so git scans the full repo history. The original add commits (in the old directory) appear first, so each file's first occurrence preserves its true creation order. Results are filtered against files that currently exist in the versions directory so unrelated files are excluded. Change-Id: If7889abdfcfb21dfeaaf5377c613f8deb2374cc3 Claude-Session-Id: dfe05075-9a44-4939-b789-53bacb722af4
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
sileht
approved these changes
Mar 31, 2026
Contributor
Merge Queue Status
This pull request spent 9 seconds in the queue, including 1 second running CI. Required conditions to merge
|
mergify
Bot
deleted the
devs/jd/worktree-mv/If7889abdfcfb21dfeaaf5377c613f8deb2374cc3
branch
March 31, 2026 09:11
mergify Bot
pushed a commit
that referenced
this pull request
May 4, 2026
…er (#24) v6 dropped the `-- versions/` pathspec from `_get_git_commit_order()` so that migrations moved to a new directory keep their original add order. Without the pathspec, git also walks feature-branch ancestors that survive merge — so a migration whose feature commit is reachable from HEAD gets that early commit's date as its sequence, even when another migration was committed on main first. That broke the engine deploy in INC-1342: a migration whose feature branch was merged with `--no-ff` (Apr 30 feature commit, May 4 merge) was placed before a migration committed directly on main on May 4 11:50, inverting the on-main order and breaking the append-only check. Add `--first-parent` so the walk stays on the integration branch and never enters feature-branch ancestors. PR #22's directory-move scenario still works because the original add commits are on main's first-parent line (they were merged before the move). Verified end-to-end against the mergify monorepo: chain head extends correctly from the previous deploy.
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.
When all migrations are moved to a new directory in a single commit,
git log --diff-filter=Awith a pathspec restricted to the newdirectory only sees the move commit as the one that "added" the files.
Within that single commit, git outputs filenames alphabetically,
losing the original chronological add order.
Fix by removing the pathspec so git scans the full repo history.
The original add commits (in the old directory) appear first, so
each file's first occurrence preserves its true creation order.
Results are filtered against files that currently exist in the
versions directory so unrelated files are excluded.