@panoptic-it-solutions/coolify-setup 1.1.25 → 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 +39 -10
  2. package/package.json +1 -1
package/dist/git.js CHANGED
@@ -99,24 +99,53 @@ export async function commitAndPushToDevelop(files, originalBranch) {
99
99
  // Develop doesn't exist remotely
100
100
  }
101
101
  if (developExistsRemotely) {
102
- // Checkout develop (create local tracking branch if needed)
102
+ // Check if develop exists locally
103
+ let developExistsLocally = false;
103
104
  try {
104
- run('git checkout develop');
105
+ run('git rev-parse --verify develop');
106
+ developExistsLocally = true;
105
107
  }
106
108
  catch {
107
- // Local develop doesn't exist, create from remote
108
- run('git checkout -b develop origin/develop');
109
+ // develop doesn't exist locally
109
110
  }
110
- // Pull latest changes
111
+ // Try to checkout develop
112
+ let checkoutSucceeded = false;
111
113
  try {
112
- 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;
113
121
  }
114
122
  catch {
115
- // 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');
116
148
  }
117
- // Merge the source branch (which has the commits)
118
- run(`git merge ${sourceBranch} --no-edit`);
119
- run('git push origin develop');
120
149
  }
121
150
  else {
122
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.25",
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",