-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The command aims to merge a work branch in `master` one. It's similar to what happen if you accept and merge a PR. #137
- Loading branch information
Showing
7 changed files
with
95 additions
and
13 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
|
||
default() { | ||
_error-if-empty "${1}" "Please give a name of remote branch (like 'origin/123')." | ||
local WORK_BRANCH="eg" | ||
boxtee git fetch --all --tags --prune | ||
boxtee git checkout -b ${WORK_BRANCH} ${RMASTER} | ||
boxtee git rebase --merge --strategy ff-only ${1} | ||
# @todo #137 Alternative flows of `accept-work` | ||
# If this command is executed with `${WORK_BRANCH}` and | ||
# 1. `git rebase` is in progress, it has to run `git rebase --continue` prior working with | ||
# `${MASTER}` branch. | ||
# 2. `git rebase` is completed (history of `${WORK_BRANCH}` and `${RMASTER}` are different), | ||
# just work with `${MASTER}` branch. | ||
boxtee git checkout ${MASTER} | ||
boxtee git merge --ff-only eg | ||
boxtee git push ${REMOTE_NAME} ${MASTER}:${MASTER} | ||
boxtee git branch --delete ${WORK_BRANCH} | ||
boxtee git push ${REMOTE_NAME} --delete $(echo "${1}" | sed -e "s|${REMOTE_NAME}/||") | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats -ex | ||
|
||
load addons-common | ||
load addons-fake | ||
|
||
teardown() { | ||
clean-fake | ||
} | ||
|
||
@test "'accept-work': a work is accepted successfully for given remote branch" { | ||
fake-pass git "fetch --all --tags --prune" | ||
fake-pass git "checkout -b eg origin/master" | ||
fake-pass git "rebase --merge --strategy ff-only origin/work" | ||
fake-pass git "checkout master" | ||
fake-pass git "merge --ff-only eg" | ||
fake-pass git "push origin master:master" | ||
fake-pass git "branch --delete eg" | ||
fake-pass git "push origin --delete work" | ||
check git-elegant accept-work origin/work | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "'accept-work': exit code is 255 when remote branch name isn't set" { | ||
check git-elegant accept-work | ||
[ "$status" -eq 255 ] | ||
} | ||
|
||
@test "'accept-work': print error message when remote branch name isn't set" { | ||
check git-elegant accept-work | ||
[[ "${lines[0]}" =~ "Please give a name of remote branch (like 'origin/123')." ]] | ||
} |
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
aa2fc0b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
137-b582b6a4
discovered inlibexec/git-elegant-accept-work
and submitted as #146. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.