#!/bin/sh # SPDX-License-Identifier: MIT set -eu export TZ=UTC LC_ALL=C export GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null export GIT_AUTHOR_NAME='Example Author' GIT_AUTHOR_EMAIL='author@example.invalid' export GIT_COMMITTER_NAME='Example Author' GIT_COMMITTER_EMAIL='author@example.invalid' export GIT_AUTHOR_DATE='2026-10-27T12:00:00+00:00' export GIT_COMMITTER_DATE='2026-10-27T12:00:00+00:00' test "$(git --version)" = 'git version 2.56.0' mkdir example-work cd example-work git init --bare -q --template= --initial-branch=main remote.git git init -q --template= --initial-branch=main project cd project git config commit.gpgsign false git config core.autocrlf false git remote add origin ../remote.git printf 'base\n' > note.txt git add note.txt git commit -qm 'Base note' git push -q -u origin main git branch stale git push -q origin stale git fetch -q origin git branch local-copy origin/stale >/dev/null git --git-dir=../remote.git update-ref -d refs/heads/stale git show-ref --verify --quiet refs/remotes/origin/stale git fetch -q --prune origin if git show-ref --verify --quiet refs/remotes/origin/stale; then printf 'Unexpected remote-tracking reference remains\n' exit 1 fi git show-ref --verify --quiet refs/heads/local-copy printf 'Pruned origin/stale; local-copy remains\n'