From e610a5104baa0b55fd8b51e0736cf0a938799589 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Sat, 10 Apr 2021 16:53:50 +0200 Subject: [PATCH] Add failing test --- tests/git-auto-commit.bats | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index 32b84e1..4447d3e 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -400,3 +400,37 @@ git_auto_commit() { assert_equal $current_sha $remote_sha } + +@test "It does not expand wildcard glob when using INPUT_PATTERN in git-status and git-add" { + + # Create additional files in a nested directory structure + echo "Create Additional files"; + touch "${FAKE_LOCAL_REPOSITORY}"/new-file-a.py + mkdir "${FAKE_LOCAL_REPOSITORY}"/nested + touch "${FAKE_LOCAL_REPOSITORY}"/nested/new-file-b.py + + # Commit changes + echo "Commit changes before running git_auto_commit"; + cd "${FAKE_LOCAL_REPOSITORY}"; + git add . > /dev/null; + git commit --quiet -m "Init Remote Repository"; + git push origin master > /dev/null; + + # Make nested file dirty + echo "foo-bar" > "${FAKE_LOCAL_REPOSITORY}"/nested/new-file-b.py; + + # --- + + INPUT_FILE_PATTERN="*.py" + + run git_auto_commit + + assert_success + + assert_line "INPUT_FILE_PATTERN: *.py" + assert_line "::debug::Push commit to remote branch master" + + # Assert that py files have not been added. + run git status + refute_output --partial 'nested/new-file-b.py' +}