Skip to content

Commit fed3a61

Browse files
ncclementibrycelelbach
authored andcommitted
make test-links macos compatible
1 parent c7feff8 commit fed3a61

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎brev/test-links.bash‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if ! command -v lychee &> /dev/null; then
5656
exit 1
5757
fi
5858

59-
REPO_ROOT="$(pwd)"
59+
REPO_ROOT="$(realpath "$(pwd)")"
6060
TARGET_PATHS=("$@")
6161

6262
# Validate all paths exist and are inside the repo
@@ -67,8 +67,12 @@ for target in "${TARGET_PATHS[@]}"; do
6767
echo -e "${RED}Error: Path '$target' does not exist${NC}"
6868
exit 1
6969
fi
70-
rel="$(realpath --relative-to="$REPO_ROOT" "$(realpath "$target")")"
71-
if [[ "$rel" == ../* ]]; then
70+
target_abs="$(realpath "$target")"
71+
if [[ "$target_abs" == "$REPO_ROOT" ]]; then
72+
rel="."
73+
elif [[ "$target_abs" == "$REPO_ROOT"/* ]]; then
74+
rel="${target_abs#"$REPO_ROOT"/}"
75+
else
7276
echo -e "${RED}Error: Path '$target' is not within the current repository${NC}"
7377
exit 1
7478
fi

0 commit comments

Comments
 (0)