@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.
- package/dist/git.js +34 -12
- 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
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|