-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(scp): add verbose, interactive, and dry-run flags #1261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+172
−20
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aef6cc1
feat(scp): add -v/--verbose and -i/--interactive flags
anderewrey 37706bc
feat(scp): add -n/--dry-run flag
anderewrey e83c982
test(scp): add coverage for -n/--dry-run and -i/--interactive abort
anderewrey 220e512
feat(scp): Code review
anderewrey eab4b0e
feat(scp): Code review
anderewrey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # shellcheck shell=bash | ||
|
|
||
| source "$BATS_TEST_DIRNAME/test_util.sh" | ||
|
|
||
| setup_file() { | ||
| test_util.setup_file | ||
| } | ||
|
|
||
| setup() { | ||
| test_util.cd_test | ||
|
|
||
| test_util.git_init | ||
| printf '%s\n' 'hello' > tracked.txt | ||
| git add tracked.txt | ||
| git commit -m 'Initial commit' | ||
|
|
||
| # never created: neither test below should ever touch it | ||
| git remote add fake "$BATS_TEST_TMPDIR/never-created" | ||
|
|
||
| printf '%s\n' 'world' >> tracked.txt | ||
| } | ||
|
|
||
| @test "dry-run previews the sync without changing anything" { | ||
| run git scp -n fake | ||
| assert_success | ||
| assert_line -p 'tracked.txt' | ||
| assert_line -p 'DRY RUN' | ||
|
|
||
| run git status --short | ||
| assert_line -p 'M tracked.txt' | ||
|
|
||
| run test -e "$BATS_TEST_TMPDIR/never-created" | ||
| assert_failure | ||
| } | ||
|
|
||
| @test "interactive mode aborts without syncing when declined" { | ||
| run bash -c 'echo n | git scp -i fake' | ||
| assert_success | ||
| assert_line -p 'Aborted, nothing synced.' | ||
|
|
||
| run git status --short | ||
| assert_line -p 'M tracked.txt' | ||
|
|
||
| run test -e "$BATS_TEST_TMPDIR/never-created" | ||
| assert_failure | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.