aboutsummaryrefslogtreecommitdiff
path: root/scripts/vim-patch.sh
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-05-16 23:53:56 -0400
committerJames McCoy <jamessan@jamessan.com>2016-05-19 06:40:47 -0400
commit957c91d5d041a8f6d5a9cb5b5a771b1c08d872aa (patch)
tree37489824c0692bef511dd84a295bcb943169865b /scripts/vim-patch.sh
parentaf3d4b40492e6eb9f3ab44d819addceb29b01fe0 (diff)
downloadrneovim-957c91d5d041a8f6d5a9cb5b5a771b1c08d872aa.tar.gz
rneovim-957c91d5d041a8f6d5a9cb5b5a771b1c08d872aa.tar.bz2
rneovim-957c91d5d041a8f6d5a9cb5b5a771b1c08d872aa.zip
vim-patch.sh: Add support for sociomatic/git-hub
Diffstat (limited to 'scripts/vim-patch.sh')
-rwxr-xr-xscripts/vim-patch.sh36
1 files changed, 29 insertions, 7 deletions
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 2d9f61ff36..8f9c3c36b2 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -198,9 +198,28 @@ get_vim_patch() {
echo " for more information."
}
+hub_pr() {
+ hub pull-request -m "$1"
+}
+
+git_hub_pr() {
+ git hub pull new -m "$1"
+}
+
submit_pr() {
require_executable git
- require_executable hub
+ local push_first
+ push_first=1
+ local submit_fn
+ if check_executable hub; then
+ submit_fn="hub_pr"
+ elif check_executable git-hub; then
+ push_first=0
+ submit_fn="git_hub_pr"
+ else
+ >&2 echo "${BASENAME}: 'hub' or 'git-hub' not found in PATH or not executable."
+ exit 1
+ fi
cd "${NEOVIM_SOURCE_DIR}"
local checked_out_branch
@@ -223,14 +242,17 @@ submit_pr() {
local pr_message
pr_message="$(printf '[RFC] vim-patch:%s\n\n%s\n' "${pr_title#,}" "${pr_body}")"
- echo "Pushing to 'origin/${checked_out_branch}'."
- output="$(git push origin "${checked_out_branch}" 2>&1)" &&
- echo "✔ ${output}" ||
- (echo "✘ ${output}"; git reset --soft HEAD^1; false)
+ if [[ $push_first -ne 0 ]]; then
+ echo "Pushing to 'origin/${checked_out_branch}'."
+ output="$(git push origin "${checked_out_branch}" 2>&1)" &&
+ echo "✔ ${output}" ||
+ (echo "✘ ${output}"; git reset --soft HEAD^1; false)
+
+ echo
+ fi
- echo
echo "Creating pull request."
- output="$(hub pull-request -F - 2>&1 <<< "${pr_message}")" &&
+ output="$(${submit_fn} "${pr_message}" 2>&1)" &&
echo "✔ ${output}" ||
(echo "✘ ${output}"; false)