|
| 1 | +#!/bin/bash |
| 2 | +##===----------------------------------------------------------------------===## |
| 3 | +## |
| 4 | +## This source file is part of the Swift OpenFeature open source project |
| 5 | +## |
| 6 | +## Copyright (c) 2024 the Swift OpenFeature project authors |
| 7 | +## Licensed under Apache License v2.0 |
| 8 | +## |
| 9 | +## See LICENSE.txt for license information |
| 10 | +## |
| 11 | +## SPDX-License-Identifier: Apache-2.0 |
| 12 | +## |
| 13 | +##===----------------------------------------------------------------------===## |
| 14 | + |
| 15 | +##===----------------------------------------------------------------------===## |
| 16 | +## |
| 17 | +## This source file is part of the Swift.org open source project |
| 18 | +## |
| 19 | +## Copyright (c) 2024 Apple Inc. and the Swift project authors |
| 20 | +## Licensed under Apache License v2.0 with Runtime Library Exception |
| 21 | +## |
| 22 | +## See https://swift.org/LICENSE.txt for license information |
| 23 | +## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 24 | +## |
| 25 | +##===----------------------------------------------------------------------===## |
| 26 | + |
| 27 | +set -euo pipefail |
| 28 | + |
| 29 | +log() { printf -- "** %s\n" "$*" >&2; } |
| 30 | +error() { printf -- "** ERROR: %s\n" "$*" >&2; } |
| 31 | +fatal() { error "$@"; exit 1; } |
| 32 | + |
| 33 | +log "Checking for broken symlinks..." |
| 34 | +num_broken_symlinks=0 |
| 35 | +while read -r -d '' file; do |
| 36 | + if ! test -e "./${file}"; then |
| 37 | + error "Broken symlink: ${file}" |
| 38 | + ((num_broken_symlinks++)) |
| 39 | + fi |
| 40 | +done < <(git ls-files -z) |
| 41 | + |
| 42 | +if [ "${num_broken_symlinks}" -gt 0 ]; then |
| 43 | + fatal "❌ Found ${num_broken_symlinks} symlinks." |
| 44 | +fi |
| 45 | + |
| 46 | +log "✅ Found 0 symlinks." |
0 commit comments