@panoptic-it-solutions/coolify-setup 1.1.26 → 1.1.27

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.
Files changed (2) hide show
  1. package/dist/git.js +34 -12
  2. package/package.json +1 -1
package/dist/git.js CHANGED
@@ -108,22 +108,44 @@ export async function commitAndPushToDevelop(files, originalBranch) {
108
108
  catch {
109
109
  // develop doesn't exist locally
110
110
  }
111
- if (developExistsLocally) {
112
- run('git checkout develop');
113
- }
114
- else {
115
- run('git checkout -b develop origin/develop');
116
- }
117
- // Pull latest changes
111
+ // Try to checkout develop
112
+ let checkoutSucceeded = false;
118
113
  try {
119
- run('git pull --rebase origin develop');
114
+ if (developExistsLocally) {
115
+ run('git checkout develop');
116
+ }
117
+ else {
118
+ run('git checkout -b develop origin/develop');
119
+ }
120
+ checkoutSucceeded = true;
120
121
  }
121
122
  catch {
122
- // Pull might fail, continue
123
+ // Checkout failed - might be worktree issue
124
+ // Try fast-forward push if source branch contains all develop commits
125
+ try {
126
+ run(`git merge-base --is-ancestor origin/develop ${sourceBranch}`);
127
+ // Source branch is ahead of develop, can fast-forward push
128
+ run(`git push origin ${sourceBranch}:develop`);
129
+ result.pushed = true;
130
+ return result;
131
+ }
132
+ catch {
133
+ // Can't fast-forward - develop has diverged, need real merge
134
+ throw new Error('Cannot checkout develop (may be used by another worktree) and branches have diverged. Please merge manually.');
135
+ }
136
+ }
137
+ if (checkoutSucceeded) {
138
+ // Pull latest changes
139
+ try {
140
+ run('git pull --rebase origin develop');
141
+ }
142
+ catch {
143
+ // Pull might fail, continue
144
+ }
145
+ // Merge the source branch (which has the commits)
146
+ run(`git merge ${sourceBranch} --no-edit`);
147
+ run('git push origin develop');
123
148
  }
124
- // Merge the source branch (which has the commits)
125
- run(`git merge ${sourceBranch} --no-edit`);
126
- run('git push origin develop');
127
149
  }
128
150
  else {
129
151
  // Develop doesn't exist remotely, create it from source branch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",