Add --first-parent-baseline flag - #1450
Open
brady-zip wants to merge 1 commit into
Open
Conversation
Resolve the TurboSnap baseline by walking only the first-parent (mainline) history, so ancestry never descends into merged-in branch histories. Plumbed as a branch-glob option following `ignoreLastBuildOnBranch`: the glob is matched in the `gitInfo` task and `getParentCommits` receives a plain boolean, so `node-src/git/` stays glob-unaware. The boolean is threaded through `step` into `nextCommits`, where it interpolates `--first-parent` into the `git rev-list` ancestry walk. Default (flag unset) behavior is unchanged.
This was referenced Aug 19, 2026
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.
Adds an opt-in
--first-parent-baseline [branch]flag that passes--first-parentto thegit rev-listancestry walk innextCommits, so baseline resolution stays on the mainline instead of descending into merged-in branch histories.Context and motivation: #1449. This is the smaller of the two flags proposed there, and it carries the plumbing that the second one (
--ignore-merged-pr-builds) builds on, so it goes first.Behaviour
Default (flag unset) behaviour is byte-identical to today — the flag only ever adds
--first-parentto therev-listinvocation.Branch-glob scoped, following
--ignore-last-build-on-branchexactly, so it can be enabled on the trunk only while PR builds keep the default base-branch baseline:--first-parent-baselinewith no value meanstrue(viatrueIfSet), matching--auto-accept-changesand friends.Implementation
Standard option plumbing, one change per file:
node-src/lib/parseArguments.tsflagsentrynode-src/types.tsFlags.firstParentBaseline,Options.firstParentBaselinenode-src/lib/getOptions.tsdefaultOptionsentry +trueIfSet(flags.firstParentBaseline)node-src/lib/getConfiguration.tsz.union([z.string(), z.boolean()])action.ymlfirstParentBaselineinput (alphabetical)action-src/main.tsgetInput+runNodeflags entrynode-src/tasks/gitInfo.tsGitInfoInput+extractGitInfoInput, resolved viagit.matchesBranch(firstParentBaseline || false)node-src/git/getParentCommits.tsgetParentCommits→step→nextCommits, interpolated into therev-listcommandThe glob is resolved in the
gitInfotask andgetParentCommitsreceives a plain boolean, sonode-src/git/stays glob-unaware — same seamignoreLastBuildOnBranchuses.Testing
node-src/git/getParentCommits.test.ts: newfirstParentBaselinecase on thesimpleLoopfixture (F = merge(D, E),DisF's first parent) asserting both halves in one test — without the optionEis included (it is a genuine ancestor), with the option the walk never reaches it. Because this suite runsgetParentCommitsagainst real generated git repositories, the assertion only holds if--first-parentactually reachesgit rev-list.node-src/lib/getOptions.test.ts: flag → option for the glob form, and the bare-flagtrueIfSetpath; plusfirstParentBaseline: undefinedadded to the defaults assertion.yarn typescript:check,yarn lint,yarn build,yarn testall clean locally (1007 passing).Labels
Requesting
minor+release— I don't have permission to set them.