edsger 0.21.6 → 0.21.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,19 +61,15 @@ export declare function getNextPendingBranch(options: PipelinePhaseOptions): Pro
61
61
  export declare function allBranchesCompleted(options: PipelinePhaseOptions): Promise<boolean>;
62
62
  /**
63
63
  * Get the base branch information for a branch.
64
- * Returns:
65
- * - If base_branch_id is null: use main (first branch in chain)
66
- * - If base_branch_id is set and that branch is completed: use main
67
- * (completed means feat merged to main)
68
- * - If base_branch_id is set and that branch is merged: use base branch's feat branch
69
- * (merged means dev merged to feat, not to main)
70
- * - If base_branch_id is set and that branch is not merged: use base branch's dev branch
71
64
  *
72
- * When base branch is merged/completed (squash merge), we need to use `git rebase --onto` to
73
- * correctly rebase only the new commits. This function returns both the new base
74
- * and the original base for this purpose:
75
- * - completed: baseBranch=main, originalBaseBranch=feat/xxx
76
- * - merged: baseBranch=feat/xxx, originalBaseBranch=dev/xxx
65
+ * Rebase strategies based on base branch status:
66
+ * - no base_branch_id: git rebase main (first branch in chain)
67
+ * - completed (feat merged to main): git rebase main
68
+ * - merged (dev merged to feat): git rebase --onto main feat/xxx
69
+ * - in_progress/pending: git rebase dev/xxx (base on parent dev branch)
70
+ *
71
+ * For 'merged' status, we use --onto to rebase only new commits (after feat branch)
72
+ * onto main, avoiding conflicts from re-applying squashed commits.
77
73
  */
78
74
  export declare function getBaseBranchInfo(branch: Branch, allBranches: Branch[], mainBranch?: string): Promise<{
79
75
  baseBranch: string;
@@ -160,19 +160,15 @@ export async function allBranchesCompleted(options) {
160
160
  }
161
161
  /**
162
162
  * Get the base branch information for a branch.
163
- * Returns:
164
- * - If base_branch_id is null: use main (first branch in chain)
165
- * - If base_branch_id is set and that branch is completed: use main
166
- * (completed means feat merged to main)
167
- * - If base_branch_id is set and that branch is merged: use base branch's feat branch
168
- * (merged means dev merged to feat, not to main)
169
- * - If base_branch_id is set and that branch is not merged: use base branch's dev branch
170
163
  *
171
- * When base branch is merged/completed (squash merge), we need to use `git rebase --onto` to
172
- * correctly rebase only the new commits. This function returns both the new base
173
- * and the original base for this purpose:
174
- * - completed: baseBranch=main, originalBaseBranch=feat/xxx
175
- * - merged: baseBranch=feat/xxx, originalBaseBranch=dev/xxx
164
+ * Rebase strategies based on base branch status:
165
+ * - no base_branch_id: git rebase main (first branch in chain)
166
+ * - completed (feat merged to main): git rebase main
167
+ * - merged (dev merged to feat): git rebase --onto main feat/xxx
168
+ * - in_progress/pending: git rebase dev/xxx (base on parent dev branch)
169
+ *
170
+ * For 'merged' status, we use --onto to rebase only new commits (after feat branch)
171
+ * onto main, avoiding conflicts from re-applying squashed commits.
176
172
  */
177
173
  export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main') {
178
174
  // No base branch - start from main (first branch in chain)
@@ -195,27 +191,21 @@ export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main'
195
191
  }
196
192
  // Check if base branch is completed (feat merged to main)
197
193
  if (baseBranch.status === 'completed') {
198
- // Base branch's feat is merged to main - rebase directly from main
199
- // Use feat branch as originalBaseBranch for --onto
200
- if (!baseBranch.branch_name) {
201
- return {
202
- baseBranch: mainBranch,
203
- needsRebase: false,
204
- baseBranchMerged: true,
205
- };
206
- }
207
- const featBranchName = baseBranch.branch_name.replace(/^dev\//, 'feat/');
194
+ // Base branch's feat is already squash-merged to main
195
+ // Just rebase directly to main - no need for --onto
196
+ // Main already contains all the changes, so a normal rebase will work correctly
208
197
  return {
209
198
  baseBranch: mainBranch,
210
- originalBaseBranch: featBranchName, // Use feat branch for --onto
211
- needsRebase: true,
199
+ // Don't set originalBaseBranch - we want a normal rebase, not --onto
200
+ needsRebase: false,
212
201
  baseBranchMerged: true,
213
202
  };
214
203
  }
215
- // Check if base branch is merged (dev merged to feat)
204
+ // Check if base branch is merged (dev merged to feat, but feat not yet merged to main)
216
205
  if (baseBranch.status === 'merged') {
217
- // Base branch's dev is merged to feat - rebase from base branch's feat branch
218
- // Convert dev/xxx/1-name to feat/xxx/1-name
206
+ // Base branch's dev is squash-merged to feat
207
+ // Use --onto to rebase only new commits (after feat branch) onto main
208
+ // This correctly handles the case where feat contains squashed commits
219
209
  if (!baseBranch.branch_name) {
220
210
  return {
221
211
  baseBranch: mainBranch,
@@ -225,8 +215,8 @@ export async function getBaseBranchInfo(branch, allBranches, mainBranch = 'main'
225
215
  }
226
216
  const featBranchName = baseBranch.branch_name.replace(/^dev\//, 'feat/');
227
217
  return {
228
- baseBranch: featBranchName,
229
- originalBaseBranch: baseBranch.branch_name, // Return original dev branch for --onto
218
+ baseBranch: mainBranch, // Rebase onto main
219
+ originalBaseBranch: featBranchName, // Use feat branch for --onto
230
220
  needsRebase: true,
231
221
  baseBranchMerged: true,
232
222
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.21.6",
3
+ "version": "0.21.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"