#!/bin/sh set -eu target=${1:-core/huya/wss_client.py} baseline_ref=${GUID_SESSION_BASELINE_REF:-HEAD} root=$(git rev-parse --show-toplevel) case "$target" in "$root"/*) file=$target; rel=${target#"$root"/} ;; /*) file=$target; rel=core/huya/wss_client.py ;; *) file="$root/$target"; rel=$target ;; esac git show "$baseline_ref:$rel" > "$file" printf '已恢复 %s(基线 %s)\n' "$file" "$baseline_ref"