From 82b6eb4331d2cfc95c8822203986271efbc3b4aa Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sat, 30 Jul 2016 10:36:14 +0100 Subject: [PATCH] Clean up git-pull-request --- bin/git-pull-request | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/git-pull-request b/bin/git-pull-request index bfd4475..9aec0e8 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -5,7 +5,7 @@ # abort() { - echo $@ + echo >&2 "$@" exit 1 } @@ -39,9 +39,7 @@ branch=${1-$(git symbolic-ref HEAD | sed 's/refs\/heads\///')} # make sure it's pushed -git push origin $branch || abort "failed to push $branch" - -# lame hack to get project +git push origin "$branch" || abort "failed to push $branch" origin=$(git config remote.origin.url) if [[ $origin == git@* ]]; then @@ -56,9 +54,9 @@ project=${project%.git} echo echo " create pull-request for $project '$branch'" echo -printf " title: " && read title -printf " body: " && read body -printf " base [master]: " && read base +printf " title: " && read -r title +printf " body: " && read -r body +printf " base [master]: " && read -r base echo # create pull request @@ -68,7 +66,7 @@ then base="master" fi -body=$(json "$title" "$body" $branch "$base") +body=$(json "$title" "$body" "$branch" "$base") curl -u "$user" "https://api.github.com/repos/$project/pulls" -d "$body"