scripts : add support for forks in pr2wt.sh (#19540)

This commit adds support for using the pr2wt.sh (pull request to
workspace) script with forks of upstream llama.cpp.
This commit is contained in:
Daniel Bevenius 2026-02-12 13:14:28 +01:00 committed by GitHub
parent f486ce9f30
commit ff599039a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -30,12 +30,18 @@ fi
PR=$1 PR=$1
[[ "$PR" =~ ^[0-9]+$ ]] || { echo "error: PR number must be numeric"; exit 1; } [[ "$PR" =~ ^[0-9]+$ ]] || { echo "error: PR number must be numeric"; exit 1; }
url_origin=$(git config --get remote.upstream.url 2>/dev/null) || \
url_origin=$(git config --get remote.origin.url) || { url_origin=$(git config --get remote.origin.url) || {
echo "error: no remote named 'origin' in this repository" echo "error: no remote named 'upstream' or 'origin' in this repository"
exit 1 exit 1
} }
org_repo=$(echo $url_origin | cut -d/ -f4-) # Extract org/repo from either https or ssh format.
if [[ $url_origin =~ ^git@ ]]; then
org_repo=$(echo $url_origin | cut -d: -f2)
else
org_repo=$(echo $url_origin | cut -d/ -f4-)
fi
org_repo=${org_repo%.git} org_repo=${org_repo%.git}
echo "org/repo: $org_repo" echo "org/repo: $org_repo"