@imdeadpool/guardex 7.0.1 → 7.0.2
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/package.json
CHANGED
|
@@ -194,6 +194,20 @@ is_clean_worktree() {
|
|
|
194
194
|
source_worktree="$(get_worktree_for_branch "$SOURCE_BRANCH")"
|
|
195
195
|
created_source_probe=0
|
|
196
196
|
source_probe_path=""
|
|
197
|
+
integration_worktree=""
|
|
198
|
+
|
|
199
|
+
cleanup() {
|
|
200
|
+
if [[ -n "$integration_worktree" && -d "$integration_worktree" ]]; then
|
|
201
|
+
git -C "$repo_root" worktree remove "$integration_worktree" --force >/dev/null 2>&1 || true
|
|
202
|
+
fi
|
|
203
|
+
if [[ "$created_source_probe" -eq 1 && -n "$source_probe_path" && -d "$source_probe_path" ]]; then
|
|
204
|
+
# Abort any in-progress git op so `worktree remove --force` succeeds on conflict-stuck probes.
|
|
205
|
+
git -C "$source_probe_path" rebase --abort >/dev/null 2>&1 || true
|
|
206
|
+
git -C "$source_probe_path" merge --abort >/dev/null 2>&1 || true
|
|
207
|
+
git -C "$repo_root" worktree remove "$source_probe_path" --force >/dev/null 2>&1 || true
|
|
208
|
+
fi
|
|
209
|
+
}
|
|
210
|
+
trap cleanup EXIT
|
|
197
211
|
|
|
198
212
|
if [[ -z "$source_worktree" ]]; then
|
|
199
213
|
source_probe_path="${agent_worktree_root}/__source-probe-${SOURCE_BRANCH//\//__}-$(date +%Y%m%d-%H%M%S)"
|
|
@@ -261,16 +275,6 @@ mkdir -p "$(dirname "$integration_worktree")"
|
|
|
261
275
|
git -C "$repo_root" worktree add "$integration_worktree" "$start_ref" >/dev/null
|
|
262
276
|
git -C "$integration_worktree" checkout -b "$integration_branch" >/dev/null
|
|
263
277
|
|
|
264
|
-
cleanup() {
|
|
265
|
-
if [[ -d "$integration_worktree" ]]; then
|
|
266
|
-
git -C "$repo_root" worktree remove "$integration_worktree" --force >/dev/null 2>&1 || true
|
|
267
|
-
fi
|
|
268
|
-
if [[ "$created_source_probe" -eq 1 && -n "$source_probe_path" && -d "$source_probe_path" ]]; then
|
|
269
|
-
git -C "$repo_root" worktree remove "$source_probe_path" --force >/dev/null 2>&1 || true
|
|
270
|
-
fi
|
|
271
|
-
}
|
|
272
|
-
trap cleanup EXIT
|
|
273
|
-
|
|
274
278
|
if git -C "$repo_root" show-ref --verify --quiet "refs/remotes/origin/${BASE_BRANCH}"; then
|
|
275
279
|
git -C "$source_worktree" fetch origin "$BASE_BRANCH" --quiet
|
|
276
280
|
|