mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-01-05 02:15:35 +00:00
Assert throws error when force adding ignored files
See https://github.com/stefanzweifel/git-auto-commit-action/issues/204#issuecomment-1236880360
This commit is contained in:
parent
dce7e85096
commit
4e7c0d67cd
@ -839,3 +839,36 @@ git_auto_commit() {
|
||||
assert_line --partial "new-file-1.neon"
|
||||
assert_line --partial "foo/new-file-2.neon"
|
||||
}
|
||||
|
||||
@test "throws error if tries to force add ignored files which do not have any changes" {
|
||||
# Create 2 files which will later will be added to .gitignore
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/ignored-file.txt
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/another-ignored-file.txt
|
||||
|
||||
# Commit the 2 new files
|
||||
run git_auto_commit
|
||||
|
||||
# Add our txt files to gitignore
|
||||
echo "ignored-file.txt" >> "${FAKE_LOCAL_REPOSITORY}"/.gitignore
|
||||
echo "another-ignored-file.txt" >> "${FAKE_LOCAL_REPOSITORY}"/.gitignore
|
||||
|
||||
# Commit & push .gitignore changes
|
||||
run git_auto_commit
|
||||
|
||||
# Sanity check that txt files are ignored
|
||||
run cat "${FAKE_LOCAL_REPOSITORY}"/.gitignore
|
||||
assert_output --partial "ignored-file.txt"
|
||||
assert_output --partial "another-ignored-file.txt";
|
||||
|
||||
# Configure git-auto-commit
|
||||
INPUT_SKIP_DIRTY_CHECK=true
|
||||
INPUT_ADD_OPTIONS="-f"
|
||||
INPUT_FILE_PATTERN="ignored-file.txt another-ignored-file.txt"
|
||||
|
||||
# Run git-auto-commit with special configuration
|
||||
run git_auto_commit
|
||||
|
||||
assert_output --partial "nothing to commit, working tree clean";
|
||||
|
||||
assert_failure;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user