@feigi/fleet-ctl 3.143.0 → 3.143.1
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
package/scripts/reap.sh
CHANGED
|
@@ -442,8 +442,10 @@ keep() {
|
|
|
442
442
|
# silent (measured on this exact shape).
|
|
443
443
|
#
|
|
444
444
|
# The capture is `probe`, over any command; `git_probe` is `probe git`.
|
|
445
|
-
# pr_load's gh call below is
|
|
446
|
-
#
|
|
445
|
+
# pr_load's gh call below is a caller too: its stdout fields are refnames,
|
|
446
|
+
# numbers, object ids and fixed words, none of which can hold 0x02. So are the
|
|
447
|
+
# pair test's `pq_ids`, which prints `git patch-id`'s hex pairs and nothing
|
|
448
|
+
# else, and its `pq_marked`, which prints object ids and nothing else.
|
|
447
449
|
gp_sep=$(printf '\002')
|
|
448
450
|
probe() {
|
|
449
451
|
gp_raw=$(
|
|
@@ -998,6 +1000,141 @@ EOF
|
|
|
998
1000
|
return 1
|
|
999
1001
|
}
|
|
1000
1002
|
|
|
1003
|
+
# THE PAIR TEST. `git cherry` reads a commit as merged when $base carries a
|
|
1004
|
+
# commit with the same patch id, and a patch id ignores where in a file the
|
|
1005
|
+
# change sits and any whitespace in it. So a commit making a merged change
|
|
1006
|
+
# again at another place in the same file — the second of two identical
|
|
1007
|
+
# blocks — or differing from a merged commit only in whitespace reads `-`
|
|
1008
|
+
# although no other ref holds it. Measured, git 2.54.0 (Apple Git-157): a
|
|
1009
|
+
# claim's first commit squash-merged, its second, never pushed, making the
|
|
1010
|
+
# same change in the file's identical second block — `git cherry` prints `-`
|
|
1011
|
+
# for both.
|
|
1012
|
+
#
|
|
1013
|
+
# So where no line reads `+`, the tip is merged only when every commit in
|
|
1014
|
+
# $base_rev..tip also pairs: some commit M on $base carries its patch id
|
|
1015
|
+
# (`git patch-id --stable`), and `git merge-tree --write-tree --merge-base=C^
|
|
1016
|
+
# M^ C` writes exactly M's tree — C replayed onto M's parent is M. Anything
|
|
1017
|
+
# less is a KEEP with its reason: a merge commit in the range (`git cherry`
|
|
1018
|
+
# skips merges, so what a merge itself changes is read by nothing), a commit
|
|
1019
|
+
# no M carries the patch id of (an empty commit has none: a false keep, and a
|
|
1020
|
+
# harmless one), a replay that differs from or conflicts with every such M,
|
|
1021
|
+
# and any probe that fails. A `+` is not this test's: it keeps, or goes to the
|
|
1022
|
+
# second proof above, unchanged.
|
|
1023
|
+
#
|
|
1024
|
+
# M is looked for among the commits on $base that `git rev-list
|
|
1025
|
+
# --cherry-mark` marks `=` against this tip, so the diffs this script reads
|
|
1026
|
+
# are those commits' and the tip's own, never all of $base since the fork.
|
|
1027
|
+
# That listing itself still names every commit on $base since the fork, and
|
|
1028
|
+
# `probe` splits its capture with `${…#*sep}`, which bash 3.2 — macOS /bin/sh
|
|
1029
|
+
# — runs in time that grows faster than the capture: measured, doubling a
|
|
1030
|
+
# 1600-line capture took `probe` from 3.9s to 18.7s, and on a fork 3200
|
|
1031
|
+
# commits behind a dry run took 6.2s with the whole listing through `probe`
|
|
1032
|
+
# and 0.4s with the `=` ids alone, same payload. So
|
|
1033
|
+
# `pq_marked` keeps the listing to itself and prints only the `=` lines' ids,
|
|
1034
|
+
# and what reaches `probe` grows with the merged commits alone.
|
|
1035
|
+
# Safe for `probe`'s separator: rev-list and rev-parse print object ids and
|
|
1036
|
+
# fixed marks; merge-tree under `--no-messages --name-only` prints a tree id
|
|
1037
|
+
# and, on a conflict, the conflicted paths C-quoted (`"we\002ird"`, measured,
|
|
1038
|
+
# under core.quotePath false too); and `pq_ids` keeps the diff text, which can
|
|
1039
|
+
# hold any byte, to itself and prints only `git patch-id`'s hex pairs. Both of
|
|
1040
|
+
# its pipes read a variable, never git, so the status each returns is git's.
|
|
1041
|
+
# `pq_marked`'s pipe reads a variable too, and git's own status is taken
|
|
1042
|
+
# before it runs.
|
|
1043
|
+
# `merge-tree --write-tree` writes the trees it merges into the object store,
|
|
1044
|
+
# on a dry run too; it moves and deletes nothing.
|
|
1045
|
+
pq_ids() {
|
|
1046
|
+
pq_d=$(printf '%s\n' "$1" | git diff-tree --stdin -p) || return
|
|
1047
|
+
printf '%s\n' "$pq_d" | git patch-id --stable
|
|
1048
|
+
}
|
|
1049
|
+
pq_marked() {
|
|
1050
|
+
pq_l=$(git rev-list --cherry-mark --left-only --no-merges "$1") || return
|
|
1051
|
+
printf '%s\n' "$pq_l" | sed -n 's/^=//p'
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
# Returns 0 when every commit on tip $1 that $base_rev lacks pairs, and 1 with
|
|
1055
|
+
# the reason in $pq_why when one does not or a probe fails.
|
|
1056
|
+
pair_test() {
|
|
1057
|
+
if ! git_probe rev-list --parents "$base_rev..$1"; then
|
|
1058
|
+
pq_why="pair test failed — cannot list the commits $base lacks$(gp_why)"
|
|
1059
|
+
return 1
|
|
1060
|
+
fi
|
|
1061
|
+
pq_cs=
|
|
1062
|
+
while read -r pq_c pq_p pq_more; do
|
|
1063
|
+
[ -n "$pq_c" ] || continue
|
|
1064
|
+
if [ -n "$pq_more" ]; then
|
|
1065
|
+
pq_why="commit $pq_c is a merge, and git cherry does not read what a merge itself changes"
|
|
1066
|
+
return 1
|
|
1067
|
+
elif [ -z "$pq_p" ]; then
|
|
1068
|
+
pq_why="commit $pq_c has no parent to replay it from"
|
|
1069
|
+
return 1
|
|
1070
|
+
fi
|
|
1071
|
+
pq_cs=${pq_cs:+$pq_cs
|
|
1072
|
+
}$pq_c
|
|
1073
|
+
done <<EOF
|
|
1074
|
+
$gp_out
|
|
1075
|
+
EOF
|
|
1076
|
+
[ -n "$pq_cs" ] || return 0
|
|
1077
|
+
|
|
1078
|
+
if ! probe pq_marked "$base_rev...$1"; then
|
|
1079
|
+
pq_why="pair test failed — cannot list the commits on $base to pair with$(gp_why)"
|
|
1080
|
+
return 1
|
|
1081
|
+
fi
|
|
1082
|
+
pq_ms=$gp_out
|
|
1083
|
+
pq_mids=
|
|
1084
|
+
if [ -n "$pq_ms" ]; then
|
|
1085
|
+
if ! probe pq_ids "$pq_ms"; then
|
|
1086
|
+
pq_why="pair test failed — cannot compute the patch ids of the commits on $base$(gp_why)"
|
|
1087
|
+
return 1
|
|
1088
|
+
fi
|
|
1089
|
+
pq_mids=$gp_out
|
|
1090
|
+
fi
|
|
1091
|
+
if ! probe pq_ids "$pq_cs"; then
|
|
1092
|
+
pq_why="pair test failed — cannot compute the patch ids of the commits $base lacks$(gp_why)"
|
|
1093
|
+
return 1
|
|
1094
|
+
fi
|
|
1095
|
+
pq_cids=$gp_out
|
|
1096
|
+
|
|
1097
|
+
for pq_c in $pq_cs; do
|
|
1098
|
+
pq_id=
|
|
1099
|
+
while read -r pq_i pq_o; do
|
|
1100
|
+
[ "$pq_o" != "$pq_c" ] || pq_id=$pq_i
|
|
1101
|
+
done <<EOF
|
|
1102
|
+
$pq_cids
|
|
1103
|
+
EOF
|
|
1104
|
+
pq_with=
|
|
1105
|
+
if [ -n "$pq_id" ]; then
|
|
1106
|
+
while read -r pq_i pq_o; do
|
|
1107
|
+
[ "$pq_i" != "$pq_id" ] || pq_with="$pq_with $pq_o"
|
|
1108
|
+
done <<EOF
|
|
1109
|
+
$pq_mids
|
|
1110
|
+
EOF
|
|
1111
|
+
fi
|
|
1112
|
+
if [ -z "$pq_with" ]; then
|
|
1113
|
+
pq_why="commit $pq_c reads patch-equivalent, but no commit on $base carries its patch id"
|
|
1114
|
+
return 1
|
|
1115
|
+
fi
|
|
1116
|
+
for pq_m in $pq_with; do
|
|
1117
|
+
if ! git_probe rev-parse --verify "$pq_m^{tree}"; then
|
|
1118
|
+
pq_why="pair test failed — cannot read the tree of $pq_m$(gp_why)"
|
|
1119
|
+
return 1
|
|
1120
|
+
fi
|
|
1121
|
+
pq_mt=$gp_out
|
|
1122
|
+
if git_probe merge-tree --write-tree --no-messages --name-only --merge-base="$pq_c^" "$pq_m^" "$pq_c"; then
|
|
1123
|
+
[ "$gp_out" != "$pq_mt" ] || continue 2
|
|
1124
|
+
elif [ "$gp_rc" -ne 1 ]; then
|
|
1125
|
+
pq_why="pair test failed — cannot replay commit $pq_c onto $pq_m^$(gp_why)"
|
|
1126
|
+
return 1
|
|
1127
|
+
fi
|
|
1128
|
+
done
|
|
1129
|
+
case "$pq_with" in
|
|
1130
|
+
*" "*" "*) pq_why="commit $pq_c reads patch-equivalent but is not identical to any of the merged commits$pq_with" ;;
|
|
1131
|
+
*) pq_why="commit $pq_c reads patch-equivalent but is not identical to the merged commit$pq_with" ;;
|
|
1132
|
+
esac
|
|
1133
|
+
return 1
|
|
1134
|
+
done
|
|
1135
|
+
return 0
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1001
1138
|
# %(upstream:track) emits exactly [gone] as its own field — nothing to
|
|
1002
1139
|
# pattern-match, and no -v/-vv trap.
|
|
1003
1140
|
#
|
|
@@ -1170,21 +1307,22 @@ for b in $gone_branches $nu_branches; do
|
|
|
1170
1307
|
# verdict a genuinely clean cherry produces, so "merged" is indistinguishable
|
|
1171
1308
|
# from "the probe could not answer". An unmerged branch is never the ambiguous
|
|
1172
1309
|
# one: its `+` line makes grep exit 0 and always keeps. Of the checks that
|
|
1173
|
-
# must pass before the delete, this
|
|
1174
|
-
# is merged — the worktree checks below and the
|
|
1175
|
-
# can each keep the branch, but none of them looks
|
|
1176
|
-
# compare-and-swap refuses a ref that moved off
|
|
1177
|
-
# is unmerged — so an unanswerable probe must
|
|
1178
|
-
# shape the worktree `status` check below already
|
|
1310
|
+
# must pass before the delete, this and the pair test after it are the only
|
|
1311
|
+
# ones that ask whether `$tip` is merged — the worktree checks below and the
|
|
1312
|
+
# `worktree remove` refusal can each keep the branch, but none of them looks
|
|
1313
|
+
# at its commits, and the compare-and-swap refuses a ref that moved off
|
|
1314
|
+
# `$tip`, never a `$tip` that is unmerged — so an unanswerable probe must
|
|
1315
|
+
# KEEP, the same fail-closed shape the worktree `status` check below already
|
|
1316
|
+
# uses.
|
|
1179
1317
|
# `refs/heads/$b`, never a bare `$b`, where the tip is read above. Restoring
|
|
1180
1318
|
# the bare name makes a branch that shares its name with a tag ambiguous AS A
|
|
1181
1319
|
# REV again, and git resolves an ambiguous one by preferring refs/tags/ over
|
|
1182
1320
|
# refs/heads/ (measured, git 2.50.1 Apple Git-155). This probe would then
|
|
1183
1321
|
# answer about the TAG's commit while the delete below removes the BRANCH —
|
|
1184
1322
|
# and a tag sitting on a merged commit reports clean for a branch whose
|
|
1185
|
-
# commits exist nowhere else. No other check before the delete
|
|
1186
|
-
# those commits are merged, so that
|
|
1187
|
-
# them: measured on a fixture, the enumeration fix alone turned a branch
|
|
1323
|
+
# commits exist nowhere else. No other check before the delete then asked
|
|
1324
|
+
# whether those commits are merged, so that read straight through to
|
|
1325
|
+
# destroying them: measured on a fixture, the enumeration fix alone turned a branch
|
|
1188
1326
|
# this script currently KEEPS into `REAPED`, at exit 0, with an empty
|
|
1189
1327
|
# kept[]. Qualifying changes nothing for an ordinary branch — both spellings
|
|
1190
1328
|
# name the same commit — and it is the same key the worktree lookup below
|
|
@@ -1198,8 +1336,8 @@ for b in $gone_branches $nu_branches; do
|
|
|
1198
1336
|
# existed nowhere else REAPED at exit 0 with an empty kept[]. The
|
|
1199
1337
|
# qualification is built at the top of the file, where its own comment
|
|
1200
1338
|
# records why the accept-list beside it is what makes prefixing sound. Being
|
|
1201
|
-
#
|
|
1202
|
-
# whether this check itself can be wrong — which is why BOTH revs it
|
|
1339
|
+
# one of only two merge checks bounds what ELSE could catch an unmerged
|
|
1340
|
+
# branch, not whether this check itself can be wrong — which is why BOTH revs it
|
|
1203
1341
|
# consumes are qualified.
|
|
1204
1342
|
elif ! cherry=$(git cherry "$base_rev" "$tip" 2>&1); then
|
|
1205
1343
|
keep "$b" "cherry probe failed — cannot tell if merged: $(printf '%s' "$cherry" | tr '\n' ' ')"
|
|
@@ -1215,7 +1353,7 @@ for b in $gone_branches $nu_branches; do
|
|
|
1215
1353
|
# exists for: taking it is not the same as READING it. grep answers three
|
|
1216
1354
|
# ways, and the `if` once had two arms — an rc 2 scan that never
|
|
1217
1355
|
# examined `$cherry` fell into the merged arm, and no check between here and
|
|
1218
|
-
# the delete below
|
|
1356
|
+
# the delete below then asked whether the branch is merged. So the deletion went
|
|
1219
1357
|
# ahead on a merge status no tool had established. `grep_probe` splits the two
|
|
1220
1358
|
# questions; the answers are ruled on here, in the order that makes the
|
|
1221
1359
|
# unanswerable case fail CLOSED like every other could-not-check in this
|
|
@@ -1241,6 +1379,11 @@ for b in $gone_branches $nu_branches; do
|
|
|
1241
1379
|
keep "$b" "unmerged commits — $pr_why"
|
|
1242
1380
|
continue
|
|
1243
1381
|
fi
|
|
1382
|
+
# No `+`: merged only if every commit the tip holds and $base lacks pairs
|
|
1383
|
+
# with one $base carries — the pair test, its header above the loop.
|
|
1384
|
+
elif ! pair_test "$tip"; then
|
|
1385
|
+
keep "$b" "$pq_why"
|
|
1386
|
+
continue
|
|
1244
1387
|
fi
|
|
1245
1388
|
|
|
1246
1389
|
# The listing is read per branch, through worktree.sh's `wt_counts`, which
|
|
@@ -1905,6 +2048,11 @@ else
|
|
|
1905
2048
|
elif [ "$gq_rc" -eq 0 ]; then
|
|
1906
2049
|
keep "" "worktree $wt holds commits that exist nowhere else"
|
|
1907
2050
|
continue
|
|
2051
|
+
# No `+`: the pair test, as in the branch sweep; its header is above that
|
|
2052
|
+
# sweep's loop.
|
|
2053
|
+
elif ! pair_test "$head"; then
|
|
2054
|
+
keep "" "worktree $wt — $pq_why"
|
|
2055
|
+
continue
|
|
1908
2056
|
fi
|
|
1909
2057
|
|
|
1910
2058
|
if [ -e "$wt" ]; then
|
|
@@ -1455,8 +1455,9 @@ else
|
|
|
1455
1455
|
# update-ref, authorized by the `ahead` and `git cherry` guards above,
|
|
1456
1456
|
# this recount, and the worktree check above — and carrying its own
|
|
1457
1457
|
# compare-and-swap on $tip on top, which `-D` never had. reap.sh asks
|
|
1458
|
-
# whether its own [gone] branches are merged with `git cherry`
|
|
1459
|
-
#
|
|
1458
|
+
# whether its own [gone] branches are merged with `git cherry` and a pair
|
|
1459
|
+
# test that replays each commit onto the one it matches — no `ahead`
|
|
1460
|
+
# count, no recount — so not this pairing, though it too
|
|
1460
1461
|
# re-checks the worktree with `wt_holding` before its own compare-and-swap
|
|
1461
1462
|
# delete. `-d` measures against HEAD and the branch's upstream, and a
|
|
1462
1463
|
# claim has no upstream until its first push (claim-ticket.sh passes
|
|
@@ -25,7 +25,8 @@ Every precondition recomputed **inside** same command as delete:
|
|
|
25
25
|
- **A branch with no upstream is selected only when origin has no branch of its name and its merged PR recorded its tip.** `%(upstream)` is empty for it, so `%(upstream:track)` has no `[gone]` to match. It is selected when `refs/remotes/origin/<b>` is absent after the sweep's own `fetch --prune`, and the second proof below ties its tip, read once, to a head its merged PR recorded; `git cherry` neither authorizes nor vetoes it, and there is no name filter. A tip already on `origin/main` ties only by **equality** with a recorded head, never by ancestry: a claim is cut from whatever `origin/main` the clone last fetched, so a fresh claim that reuses a merged PR's branch name on a clone that has not fetched that merge has no commits of its own and a tip that is an ancestor of that PR's heads — ancestry would tie it, and the reap would remove the live member's clean worktree and branch. Every keep reads `no upstream — <cause>`; where there is no GitHub repository to ask (`BASE_REF` is not an `origin` ref, or `origin` is not a `host/owner/repo` URL) it is never selected and the reason stays `no upstream — never selected`. Once selected, the worktree guards, the holder check and the compare-and-swap below run on it as on a `[gone]` branch. Its upstream arrives with the first `-u` push, or when the controller settles the implementer's report.
|
|
26
26
|
- **Recompute per branch, in this command.** Branch list from earlier tool call already false: one observed run listed 28 gone branches, two calls later 27 reaped by concurrent session. Benign direction is no-op; dangerous one is worktree that gained work *after* check.
|
|
27
27
|
- **`git cherry origin/main`, not `git diff main..`.** Against `origin/main` — local `main` you never fast-forwarded reads every merged branch as unmerged. A `+` line is a commit with no patch-equivalent upstream, which is usually a commit that exists nowhere else but not always: a claim the merge bot rebased server-side onto a `main` that had changed its context lines carries a different patch id, so its original tip reads `+` although everything on it merged. That keep is safe but leaky, and the second proof below is what closes it.
|
|
28
|
-
- **
|
|
28
|
+
- **A branch whose commits all read `-` is merged only if every one of them pairs.** A patch id ignores where in a file a change sits and any whitespace in it, so a commit making a merged change again at another place in the same file — the second of two identical blocks — or differing from a merged commit only in whitespace reads `-` while no other ref holds it. So each commit `C` that `origin/main` lacks has to pair: a commit `M` on `origin/main` carries `C`'s `git patch-id --stable`, and `git merge-tree --write-tree --merge-base=C^ M^ C` writes exactly `M`'s tree — `C` replayed onto `M`'s parent is `M`. Anything less is a KEEP with its reason: a merge commit in the range (`git cherry` skips merges, so what one changes is read by nothing), a commit no `M` carries the patch id of (an empty commit has none — a harmless false keep), a replay that differs from or conflicts with every such `M`, and any probe that fails. A `+` is not the pair test's to rule on; it keeps, or goes to the second proof below.
|
|
29
|
+
- **The delete is `git update-ref -d`'s compare-and-swap on a tip read once, authorized by that cherry check, the pair test above, and a fresh check, re-read immediately before the delete, that no worktree holds the branch.** Tip read before the cherry, cherry runs against that SHA, delete refuses unless ref still equals it — commit landing between check and delete is kept with git's own `cannot lock ref`, never force-deleted, as it was under `git branch -D`, the delete this replaced. `--no-deref`, so symref branch deletes the symref, not its target (measured). Branch's config section removed after, as `-D` did — left behind, re-created branch of same name inherits dead upstream and reads `[gone]` at once. `git branch -d` would refuse everything here: upstream gone, so falls back to comparing against `HEAD`, a possibly-behind local `main`. Never delete branch whose cherry output you did not just read.
|
|
29
30
|
- **A branch any worktree holds is a KEEP, checked right before the delete.** `update-ref` consults no worktree; `-D` did. So listing is re-read and worktree.sh's `wt_holding` asks: held by a `branch` line, or by detached worktree stopped mid `rebase -i` / mid `bisect` on it (admin dir's `head-name` / `BISECT_START`) — both routes `-D` refused on. Worktree it cannot resolve, or listing that will not re-read, is a KEEP. `--apply` only, like the delete: dry run cannot predict this refusal — not the same limitation `-D`'s dry run had, since an unrelated worktree elsewhere in the listing that this check cannot resolve keeps every `[gone]` branch, and every selected one with no upstream, in the pass (see below), a repo-wide case `-D` never produced.
|
|
30
31
|
- **A worktree that checked the branch out while the delete ran is caught after it, and the branch is put back.** git has no lock that stops `git worktree add <p> <b>` between that holder check and the delete, and such an add writes only the new worktree's `HEAD` — the ref does not move, so the compare-and-swap succeeds and leaves the worktree on a branch that no longer exists (measured, git 2.50.1). So worktree.sh's `wt_recheck_delete` re-reads the listing right after the delete — and again, up to 20 times 0.1s apart, while an add in progress is listed `locked initializing` — and when a worktree holds the branch, or the wait runs out, recreates it at the tip with a create-only `git update-ref`. The branch is a KEEP naming the worktree or the entry, and its config section stays. A restore that fails is a KEEP naming the tip, git's error and the command that restores it by hand — or, when something recreated the branch since the delete, the commit it now sits at, left as it is, since the create-only restore never overwrites it. The branch's reflog does not come back.
|
|
31
32
|
- **A cherry that cannot answer is a KEEP.** Capture git's output; never pipe git itself: `cmd | grep -q` takes grep's exit status, never cmd's, so a `git cherry` that dies (rc 128 — one unreadable loose object is enough) prints nothing, grep exits 1, and a dead probe reads identical to "nothing unmerged" (verified, git 2.50.1). Unanswerable probe authorizes no delete — same fail-closed shape as `worktree remove` below. Read the `+` anchored, too: the capture folds stderr in, so an unanchored match reads a `+` in a diagnostic as a commit. Pinned by a test.
|
|
@@ -45,7 +46,7 @@ Above walk finds branch's worktree by `branch refs/heads/<name>` line `git workt
|
|
|
45
46
|
So `reap.sh` enumerates worktrees git lists with **no `branch` line at all** and decides each on own state:
|
|
46
47
|
|
|
47
48
|
- **Bounded to `*/.worktrees/*` — fleet's own worktree home — and everything outside it is a `kept` entry.** Branch sweep authorizes its branch delete on evidence PR merged (`%(upstream:track)` reads exactly `[gone]`). This sweep has none to read: branchless + clean + patch-equivalent also describes human's `git worktree add --detach` scratch checkout that was never ticket. Unbounded, `--apply` deleted it (measured in review). Bound is ownership, never contents.
|
|
48
|
-
- **`git cherry` against `origin/main`, never `merge-base --is-ancestor`.** Branch was rebased before it merged, so tip fully upstream is patch-equivalent, not ancestor — ancestry answers no for exactly work that is safe. A `+` can also be context drift rather than missing work, so its keep is safe but leaky; this sweep
|
|
49
|
+
- **`git cherry` against `origin/main`, never `merge-base --is-ancestor`.** Branch was rebased before it merged, so tip fully upstream is patch-equivalent, not ancestor — ancestry answers no for exactly work that is safe. A `+` can also be context drift rather than missing work, so its keep is safe but leaky; this sweep runs no second proof, having no branch name to look a PR up by. Where no line reads `+`, the tip has to pass the branch sweep's pair test too. Subject is full object id off porcelain, so no refname shadows it.
|
|
49
50
|
- **Absent `branch` line is not by itself detached HEAD.** git prints none for worktree whose HEAD it cannot resolve either, reporting null object id instead — four measured corruption routes for admin `HEAD`. Nothing about such worktree decidable, so report and leave. Null id alone is not the test: unborn branch is legitimate null id and DOES carry `branch` line.
|
|
50
51
|
- **A git operation in progress is a keep, and git is no backstop for it.** Measured, git 2.50.1 (Apple Git-155): `worktree remove` *without* `--force` removes worktree holding interrupted rebase, and one holding bisect, at rc 0. Both detach, both leave `status --porcelain` empty — so every other check passes them and sequencer state, todo list and original head go with directory. Interrupted rebase is exactly how fleet worktree wanders off its branch (see `release-ticket.sh`'s own stray guard).
|
|
51
52
|
- **Every decline is a `kept` entry, `branch` null.** No branch to name. Gap was invisible precisely because nothing was reported.
|