diff options
Diffstat (limited to 'git-req.sh')
-rwxr-xr-x | git-req.sh | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -eux [ "$#" -lt 1 ] && exit 1 @@ -11,13 +11,16 @@ if ! git rev-parse --git-dir >/dev/null 2>&1 ; then fi repo_url="$(git config --get remote.origin.url)" -if [[ "${repo_url}" =~ gitlab ]] ; then - rem_ref_name="merge-requests" - loc_ref_name="mr" -else - rem_ref_name="pull" - loc_ref_name="pr" -fi +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" |