@feigi/fleet-ctl 3.28.1 → 3.28.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 +1 -1
- package/scripts/worktree.sh +23 -7
package/package.json
CHANGED
package/scripts/worktree.sh
CHANGED
|
@@ -849,11 +849,17 @@ wt_counts() {
|
|
|
849
849
|
# registered for, and the listing derives each worktree's path from exactly
|
|
850
850
|
# that file — so for the listed path it reads `$1/.git` byte for byte, and
|
|
851
851
|
# through a link to ANOTHER worktree it names that one (measured: a link `A`
|
|
852
|
-
# to sibling `B` reaches `worktrees/B`, whose `gitdir` names `B/.git`).
|
|
853
|
-
#
|
|
854
|
-
#
|
|
855
|
-
#
|
|
856
|
-
#
|
|
852
|
+
# to sibling `B` reaches `worktrees/B`, whose `gitdir` names `B/.git`). Under
|
|
853
|
+
# `worktree.useRelativePaths` git writes that file relative to the admin dir
|
|
854
|
+
# (measured: `../../../../B/.git`), so a relative one is resolved against it
|
|
855
|
+
# first. Then the registered path and $1 are compared as directory ENTRIES:
|
|
856
|
+
# the last component by bytes, because `-ef` on it would follow the link and
|
|
857
|
+
# is what cannot see this, and the parent by `-ef`, so a parent spelled
|
|
858
|
+
# through a symlink (`/tmp` for `/private/tmp`, or `..` segments) still names
|
|
859
|
+
# the same entry. Asked only of a link: a link standing in for the worktree's
|
|
860
|
+
# OWN renamed directory reaches its own admin dir and passes, and a plain
|
|
861
|
+
# directory never needs it — the NFD spelling `-ef` exists for would fail a
|
|
862
|
+
# byte compare.
|
|
857
863
|
#
|
|
858
864
|
# `&& echo x` inside the substitution, then `%?x`: `$(...)` strips EVERY
|
|
859
865
|
# trailing newline, so a `core.worktree` naming a sibling directory called $1
|
|
@@ -919,8 +925,18 @@ EOF
|
|
|
919
925
|
wt_lk_back=${wt_lk_back%x}
|
|
920
926
|
wt_lk_back=${wt_lk_back%"
|
|
921
927
|
"}
|
|
922
|
-
|
|
923
|
-
|
|
928
|
+
wt_lk_back=${wt_lk_back%/.git}
|
|
929
|
+
case $wt_lk_back in
|
|
930
|
+
/*) ;;
|
|
931
|
+
*) wt_lk_back=${wt_lk_admin%?x}/$wt_lk_back ;;
|
|
932
|
+
esac
|
|
933
|
+
case $1 in
|
|
934
|
+
*/*) wt_lk_up=${1%/*} ;;
|
|
935
|
+
*) wt_lk_up=. ;;
|
|
936
|
+
esac
|
|
937
|
+
# shellcheck disable=SC3013 # -ef as below; a `[` that cannot evaluate it fails the `!`, so it refuses
|
|
938
|
+
if [ "${wt_lk_back##*/}" != "${1##*/}" ] || ! [ "${wt_lk_back%/*}/" -ef "$wt_lk_up/" ]; then
|
|
939
|
+
wt_why="$1 is a symbolic link to another worktree's directory — its .git linkage reaches the admin dir registered for $wt_lk_back, not for $1"
|
|
924
940
|
return 1
|
|
925
941
|
fi
|
|
926
942
|
fi
|