Merge pull request #108 from stefanzweifel/fetch-repo-before-checkout
Better support branches with special characters in them
This commit is contained in:
commit
a9d1ac4f06
@ -39,6 +39,9 @@ _git_is_dirty() {
|
|||||||
_switch_to_branch() {
|
_switch_to_branch() {
|
||||||
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
||||||
|
|
||||||
|
# Fetch remote to make sure that repo can be switched to the right branch.
|
||||||
|
git fetch;
|
||||||
|
|
||||||
# Switch to branch from current Workflow run
|
# Switch to branch from current Workflow run
|
||||||
git checkout $INPUT_BRANCH;
|
git checkout $INPUT_BRANCH;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ main() {
|
|||||||
INPUT_SKIP_DIRTY_CHECK=true
|
INPUT_SKIP_DIRTY_CHECK=true
|
||||||
|
|
||||||
shellmock_expect git --type exact --match "status -s ."
|
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 exact --match "add ."
|
||||||
shellmock_expect git --type partial --match '-c'
|
shellmock_expect git --type partial --match '-c'
|
||||||
@ -109,10 +110,11 @@ main() {
|
|||||||
|
|
||||||
shellmock_verify
|
shellmock_verify
|
||||||
[ "${capture[0]}" = "git-stub status -s -- ." ]
|
[ "${capture[0]}" = "git-stub status -s -- ." ]
|
||||||
[ "${capture[1]}" = "git-stub checkout master" ]
|
[ "${capture[1]}" = "git-stub fetch" ]
|
||||||
[ "${capture[2]}" = "git-stub add ." ]
|
[ "${capture[2]}" = "git-stub checkout master" ]
|
||||||
[ "${capture[3]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
|
[ "${capture[3]}" = "git-stub add ." ]
|
||||||
[ "${capture[4]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
|
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
|
||||||
|
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
|
||||||
|
|
||||||
# Failed Exit Code
|
# Failed Exit Code
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
|
Loading…
Reference in New Issue
Block a user