mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
vim-patch.sh: Add support for sociomatic/git-hub
This commit is contained in:
parent
af3d4b4049
commit
957c91d5d0
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user