🍄WillowEfficient Git Operations

REPO_URL="$1"

REPO_NAME=$(echo "$REPO_URL" | rev | cut -d'/' -f1 | rev)
REL_TAG=$(git ls-remote -q --refs "$REPO_URL" | tail -1 | awk '{print $2}' | cut -d'/' -f3)

git clone -qn --depth=1 --filter=blob:none --single-branch "$REPO_URL"
cd "$REPO_NAME" || exit
git fetch -q --depth=1 --filter=blob:none $REPO_URL tag "$REL_TAG"
git show --no-patch "$REL_TAG"
cd ..
rm -rf "$REPO_NAME"

$ time ./rel-notes.sh https://github.com/torvalds/linux
[…]
./rel-notes.sh https://github.com/torvalds/linux  0.29s user 0.12s system 19% cpu 2.153 total
$ time ./rel-notes.sh 'https://git.sr.ht/~amolith/earl'
[…]
./rel-notes.sh 'https://git.sr.ht/~amolith/earl'  0.40s user 0.05s system 8% cpu 5.332 total
$ time ./rel-notes.sh 'https://akkoma.dev/FoundKeyGang/FoundKey'
[…]
./rel-notes.sh 'https://akkoma.dev/FoundKeyGang/FoundKey'  0.14s user 0.06s system 8% cpu 2.277 total