File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ _switch_to_branch() {
6060 else
6161 # Switch to branch from current Workflow run
6262 # shellcheck disable=SC2086
63- git checkout $INPUT_BRANCH ;
63+ git checkout $INPUT_BRANCH -- ;
6464 fi
6565}
6666
Original file line number Diff line number Diff line change @@ -507,3 +507,29 @@ git_auto_commit() {
507507 run git status
508508 assert_output --partial ' nothing to commit, working tree clean'
509509}
510+
511+ @test " It does not throw an error if branch is checked out with same name as a file or folder in the repo" {
512+
513+ # Add File called dev and commit/push
514+ echo " Create dev file" ;
515+ cd " ${FAKE_LOCAL_REPOSITORY} " ;
516+ echo this is a file named dev > dev
517+ git add dev
518+ git commit -m ' add file named dev'
519+ git update-ref refs/remotes/origin/master master
520+ git update-ref refs/remotes/origin/dev master
521+
522+ # ---
523+
524+ INPUT_BRANCH=dev
525+
526+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{4,5,6}.txt
527+
528+ run git_auto_commit
529+
530+ assert_success
531+
532+ assert_line " INPUT_REPOSITORY value: ${INPUT_REPOSITORY} "
533+ assert_line " ::set-output name=changes_detected::true"
534+ assert_line " ::debug::Push commit to remote branch dev"
535+ }
You can’t perform that action at this time.
0 commit comments