aboutsummaryrefslogtreecommitdiffstats
path: root/git-request-get.sh
blob: ad89ae37a1941572fca3a19e85ff8173608f8f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
set -eu

STR="$(cat)"

URL="$(echo "$STR" | sed -n -e '/^are available in the Git repository at:/,+2 {
s/[[:space:]]\+//
s/\(=[[:digit:]]\{2\}\)\+$//
/^\(http\|git\)/p
}')"

END="$(echo "$STR" | awk '/^for you to fetch changes up to / { print $NF }' | sed -e 's/[=:]*$//')"
git fetch "$URL" "$END"
git checkout -B _4review FETCH_HEAD