Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions website/scripts/vercel-ignore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ skip() {

cd "$(git rev-parse --show-toplevel)" || build "cannot find repo root"

# Vercel's clone has no `origin` remote, so every fetch below would fail. Add
# one for the (public) repo; the clone is thrown away after the build.
git remote get-url origin >/dev/null 2>&1 ||
{ [ -n "${VERCEL_GIT_REPO_OWNER:-}" ] && [ -n "${VERCEL_GIT_REPO_SLUG:-}" ] &&
git remote add origin "https://github.com/$VERCEL_GIT_REPO_OWNER/$VERCEL_GIT_REPO_SLUG.git"; }

# Builds if site paths changed between $1 and $2 (or the diff fails); else skips.
decide() {
local files
Expand Down
8 changes: 7 additions & 1 deletion website/scripts/vercel-ignore.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,16 @@ for branch in far-pkg far-site; do
clone="$(mktemp -d)"
git clone -q --depth=10 --branch "$branch" "file://$origin_repo" "$clone"
git -C "$clone" branch -f master HEAD
# Like Vercel's clone: no `origin` remote, so the script must fetch by URL.
git -C "$clone" remote remove origin
repo="$clone"
want=skip
[ "$branch" = far-site ] && want=build
expect "$want" "shallow clone, fork far behind master ($branch)" "$branch"
GIT_CONFIG_COUNT=3 \
GIT_CONFIG_KEY_2="url.file://$origin_repo.insteadOf" \
GIT_CONFIG_VALUE_2=https://github.com/test-owner/test-repo.git \
VERCEL_GIT_REPO_OWNER=test-owner VERCEL_GIT_REPO_SLUG=test-repo \
expect "$want" "shallow clone without origin, fork far behind master ($branch)" "$branch"
repo="$origin_repo"
rm -rf "$clone"
done
Expand Down
Loading