forked from sequoia-pgp/fast-forward
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fast-forward: Add --no-ff merge support
This change allows to choose the merge strategy to use for merging the pull-request. A merge-strategy parameter is added, allowing to choose the no-ff way (i.e. introducing a merge commit). The default strategy remains fast-forwarding the branch. Fixes sequoia-pgp#36
- Loading branch information
1 parent
042cd23
commit 931f723
Showing
2 changed files
with
46 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,17 +286,38 @@ LOG=$(mktemp) | |
|
||
if test "x$(jq -r .user.permissions.push < $PERM)" = xtrue | ||
then | ||
echo -n "Fast forwarding \`$BASE_REF\` ($BASE_SHA) to" | ||
echo " \`$PR_REF\` ($PR_SHA)." | ||
if test "x$2" = "xmerge-commit" | ||
then | ||
echo -n "Merging \`$PR_REF\` ($PR_SHA) into \`$BASE_REF\` ($BASE_SHA)." | ||
|
||
echo '```shell' | ||
( | ||
PS4='$ ' | ||
set -x | ||
git checkout "${BASE_REF}" | ||
git -c user.name='Santa CLAUS' \ | ||
-c user.email='[email protected]' \ | ||
merge --no-ff --into-name "${BASE_REF}" \ | ||
-m "Merge pull request $(github_pull_request .number) from ${PR_REF} into ${BASE_REF}" \ | ||
"${PR_SHA}" | ||
git push origin "${BASE_REF}" | ||
) | ||
echo '```' | ||
echo 0 >$EXIT_CODE | ||
|
||
echo '```shell' | ||
( | ||
PS4='$ ' | ||
set -x | ||
git push origin "$PR_SHA:$BASE_REF" | ||
) | ||
echo '```' | ||
echo 0 >$EXIT_CODE | ||
else | ||
echo -n "Fast forwarding \`$BASE_REF\` ($BASE_SHA) to" | ||
echo " \`$PR_REF\` ($PR_SHA)." | ||
|
||
echo '```shell' | ||
( | ||
PS4='$ ' | ||
set -x | ||
git push origin "$PR_SHA:$BASE_REF" | ||
) | ||
echo '```' | ||
echo 0 >$EXIT_CODE | ||
fi | ||
else | ||
echo -n "Sorry @$(github_event .sender.login)," | ||
echo -n " it is possible to fast forward \`$BASE_REF\` ($BASE_SHA)" | ||
|