File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1089,7 +1089,26 @@ END
10891089 run git_auto_commit
10901090
10911091 assert_failure;
1092- assert_line " ::error::git-status failed with:<fatal: not a git repository (or any of the parent directories): .git>"
1092+ assert_line " ::error::Not a git repository. Please make sure to run this action in a git repository. Adjust the ` repository` input if necessary."
1093+ }
1094+
1095+ @test " It detects if the repository is in a detached state and exits with an error" {
1096+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
1097+
1098+ run git_auto_commit
1099+
1100+ assert_success
1101+
1102+ # Bring local repository into a detached state
1103+ prev_commit=$( git rev-parse HEAD~1) ;
1104+ git checkout " $prev_commit " ;
1105+
1106+ touch " ${FAKE_TEMP_LOCAL_REPOSITORY} " /remote-files{4,5,6}.txt
1107+
1108+ run git_auto_commit
1109+
1110+ assert_failure;
1111+ assert_line " ::error::Repository is in detached HEAD state. Please checkout a branch before committing."
10931112}
10941113
10951114@test " it creates a tag if create_git_tag_only is set to true and a message has been supplied" {
You can’t perform that action at this time.
0 commit comments