blob: d1db37f0bfa78b9ef04669ab063b76ce4d4a2ece (
plain) (
tree)
|
|
#!/bin/sh
set -eux
[ "$#" -lt 1 ] && exit 1
req_no="$1"
if ! git rev-parse --git-dir >/dev/null 2>&1 ; then
echo "Must be run from git repo checkout."
exit 2
fi
repo_url="$(git config --get remote.origin.url)"
case $repo_url in
*gitlab*)
rem_ref_name="merge-requests"
loc_ref_name="mr"
;;
*)
rem_ref_name="pull"
loc_ref_name="pr"
;;
esac
git fetch origin refs/"$rem_ref_name"/"$req_no"/head:"$loc_ref_name"/"$req_no"
git checkout "$loc_ref_name/$req_no"
|