-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from funkjedi/status-add-options
Add options for git add/status commands
- Loading branch information
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ setup() { | |
export INPUT_COMMIT_MESSAGE="Commit Message" | ||
export INPUT_BRANCH="master" | ||
export INPUT_COMMIT_OPTIONS="" | ||
export INPUT_ADD_OPTIONS="" | ||
export INPUT_STATUS_OPTIONS="" | ||
export INPUT_FILE_PATTERN="." | ||
export INPUT_COMMIT_USER_NAME="Test Suite" | ||
export INPUT_COMMIT_USER_EMAIL="[email protected]" | ||
|
@@ -115,6 +117,20 @@ git_auto_commit() { | |
assert_line "::debug::Push commit to remote branch master" | ||
} | ||
|
||
@test "It applies INPUT_STATUS_OPTIONS when running dirty check" { | ||
INPUT_STATUS_OPTIONS="--untracked-files=no" | ||
|
||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2}.php | ||
|
||
run git_auto_commit | ||
|
||
assert_success | ||
|
||
assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}" | ||
assert_line "::set-output name=changes_detected::false" | ||
assert_line "Working tree clean. Nothing to commit." | ||
} | ||
|
||
@test "It prints a 'Nothing to commit' message in a clean repository" { | ||
run git_auto_commit | ||
|
||
|
@@ -142,6 +158,28 @@ git_auto_commit() { | |
assert_line "::debug::Apply commit options " | ||
} | ||
|
||
@test "It applies INPUT_ADD_OPTIONS when adding files" { | ||
INPUT_FILE_PATTERN="" | ||
INPUT_STATUS_OPTIONS="--untracked-files=no" | ||
INPUT_ADD_OPTIONS="-u" | ||
|
||
date > "${FAKE_LOCAL_REPOSITORY}"/remote-files1.txt | ||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2}.php | ||
|
||
run git_auto_commit | ||
|
||
assert_success | ||
|
||
assert_line "INPUT_STATUS_OPTIONS: --untracked-files=no" | ||
assert_line "INPUT_ADD_OPTIONS: -u" | ||
assert_line "INPUT_FILE_PATTERN: " | ||
assert_line "::debug::Push commit to remote branch master" | ||
|
||
# Assert that PHP files have not been added. | ||
run git status | ||
assert_output --partial 'new-file-1.php' | ||
} | ||
|
||
@test "It applies INPUT_FILE_PATTERN when creating commit" { | ||
INPUT_FILE_PATTERN="*.txt *.html" | ||
|
||
|