Skip to content

Commit 1702bf0

Browse files
committed
CI: Fix bad path checking in link test script.
1 parent 76d275b commit 1702bf0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

brev/test-links.bash

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ TARGET_ABS="$(cd "$TARGET_PATH" && pwd)" 2>/dev/null || {
5555
}
5656

5757
# Get relative path from repo root
58-
RELATIVE_TARGET="${TARGET_ABS#$REPO_ROOT/}"
59-
if [ "$RELATIVE_TARGET" = "$TARGET_ABS" ]; then
60-
# Path is not under repo root
58+
RELATIVE_TARGET="$(realpath --relative-to="$REPO_ROOT" "$TARGET_ABS")"
59+
60+
# Check if path is outside repo (would start with ../)
61+
if [[ "$RELATIVE_TARGET" == ../* ]]; then
6162
echo -e "${RED}Error: Path '$TARGET_PATH' is not within the current repository${NC}"
6263
exit 1
6364
fi

0 commit comments

Comments
 (0)