Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix checking out branch names with / chars" #122

Merged
merged 2 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ _switch_to_branch() {
git fetch;

# Switch to branch from current Workflow run
git checkout "$INPUT_BRANCH" --;
# shellcheck disable=SC2086
git checkout $INPUT_BRANCH;
}

_add_files() {
Expand Down
40 changes: 20 additions & 20 deletions tests/git-auto-commit-mocked.bats
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand Down Expand Up @@ -99,7 +99,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
Expand All @@ -111,7 +111,7 @@ main() {

shellmock_expect git --type exact --match "status -s ."
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type exact --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push origin'
Expand All @@ -123,7 +123,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
Expand All @@ -148,7 +148,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.html M new-file-2.html" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add"
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand All @@ -167,7 +167,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- a.txt b.txt c.txt new-file-1.html new-file-2.html" ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add a.txt b.txt c.txt new-file-1.html new-file-2.html" ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
Expand All @@ -181,7 +181,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add"
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand All @@ -198,7 +198,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]> --no-verify --signoff" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
Expand All @@ -214,7 +214,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add"
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand All @@ -231,7 +231,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=A Single Test -c [email protected] commit -m Commit Message --author=A Single Test <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
Expand All @@ -245,7 +245,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand All @@ -265,7 +265,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub -c user.name=Test Suite -c [email protected] tag -a v1.0.0 -m v1.0.0" ]
Expand All @@ -281,7 +281,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout master --"
shellmock_expect git --type exact --match "checkout master"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand All @@ -301,7 +301,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout master --" ]
[ "${capture[2]}" = "git-stub checkout master" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags --force" ]
Expand All @@ -316,7 +316,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout foo --"
shellmock_expect git --type exact --match "checkout foo"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push --set-upstream origin'
Expand Down Expand Up @@ -344,7 +344,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout foo --" ]
[ "${capture[2]}" = "git-stub checkout foo" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:foo --tags" ]
Expand All @@ -359,7 +359,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout --"
shellmock_expect git --type exact --match "checkout"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push origin'
Expand Down Expand Up @@ -387,7 +387,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout --" ]
[ "${capture[2]}" = "git-stub checkout" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub push origin" ]
Expand All @@ -402,7 +402,7 @@ main() {

shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
shellmock_expect git --type exact --match "fetch"
shellmock_expect git --type exact --match "checkout --"
shellmock_expect git --type exact --match "checkout"
shellmock_expect git --type partial --match "add ."
shellmock_expect git --type partial --match '-c'
shellmock_expect git --type partial --match 'push origin'
Expand Down Expand Up @@ -430,7 +430,7 @@ main() {
shellmock_verify
[ "${capture[0]}" = "git-stub status -s -- ." ]
[ "${capture[1]}" = "git-stub fetch" ]
[ "${capture[2]}" = "git-stub checkout --" ]
[ "${capture[2]}" = "git-stub checkout" ]
[ "${capture[3]}" = "git-stub add ." ]
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c [email protected] commit -m Commit Message --author=Test Suite <[email protected]>" ]
[ "${capture[5]}" = "git-stub -c user.name=Test Suite -c [email protected] tag -a v2.0.0 -m v2.0.0" ]
Expand Down