AtlatestRepositorysigil-http3

sigil-http3 / tree / scriptsprepare-nat-dependency.sh

1#!/usr/bin/env bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4source_repo=${1:-${HTTP3_NAT_SOURCE:-https://codeberg.org/sigil/sigil-nat.git}}
5pin=$(cat nat.rev)
6mkdir -p .deps
7if [ ! -d .deps/sigil-nat/.git ]; then
8 git clone --quiet --no-tags --no-hardlinks --no-checkout "$source_repo" .deps/sigil-nat
9else
10 test -z "$(git -C .deps/sigil-nat status --porcelain)"
11fi
12if ! git -C .deps/sigil-nat cat-file -e "$pin^{commit}" 2>/dev/null; then
13 git -C .deps/sigil-nat fetch --quiet "$source_repo" "$pin"
14fi
15git -C .deps/sigil-nat checkout --quiet --detach "$pin"
16test "$(git -C .deps/sigil-nat rev-parse HEAD)" = "$pin"
17printf 'Pinned sigil-nat source: %s\n' "$pin"