@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.
- package/dist/git.js +39 -10
- 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
|
-
//
|
|
102
|
+
// Check if develop exists locally
|
|
103
|
+
let developExistsLocally = false;
|
|
103
104
|
try {
|
|
104
|
-
run('git
|
|
105
|
+
run('git rev-parse --verify develop');
|
|
106
|
+
developExistsLocally = true;
|
|
105
107
|
}
|
|
106
108
|
catch {
|
|
107
|
-
//
|
|
108
|
-
run('git checkout -b develop origin/develop');
|
|
109
|
+
// develop doesn't exist locally
|
|
109
110
|
}
|
|
110
|
-
//
|
|
111
|
+
// Try to checkout develop
|
|
112
|
+
let checkoutSucceeded = false;
|
|
111
113
|
try {
|
|
112
|
-
|
|
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
|
-
//
|
|
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
|