AtlatestRepositorysigil-http3
sigil-http3 / tree / scriptsprepare-nat-dependency.sh
1
#!/usr/bin/env bash2
set -euo pipefail3
cd "$(dirname "$0")/.."4
source_repo=${1:-${HTTP3_NAT_SOURCE:-https://codeberg.org/sigil/sigil-nat.git}}5
pin=$(cat nat.rev)6
mkdir -p .deps7
if [ ! -d .deps/sigil-nat/.git ]; then8
git clone --quiet --no-tags --no-hardlinks --no-checkout "$source_repo" .deps/sigil-nat9
else10
test -z "$(git -C .deps/sigil-nat status --porcelain)"11
fi12
if ! git -C .deps/sigil-nat cat-file -e "$pin^{commit}" 2>/dev/null; then13
git -C .deps/sigil-nat fetch --quiet "$source_repo" "$pin"14
fi15
git -C .deps/sigil-nat checkout --quiet --detach "$pin"16
test "$(git -C .deps/sigil-nat rev-parse HEAD)" = "$pin"17
printf 'Pinned sigil-nat source: %s\n' "$pin"