-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run commands when adding worktrees (#57)
Closes #6
- Loading branch information
Showing
7 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use command_error::CommandExt; | ||
use expect_test::expect; | ||
use test_harness::GitProle; | ||
use test_harness::WorktreeState; | ||
|
||
#[test] | ||
fn config_commands() -> miette::Result<()> { | ||
let prole = GitProle::new()?; | ||
prole.setup_worktree_repo("my-repo")?; | ||
|
||
prole.write_config( | ||
r#" | ||
commands = [ | ||
"sh -c 'echo Puppy wuz here > puppy-log'", | ||
{ sh = ''' | ||
echo 2wice the Pupyluv >> puppy-log | ||
''' }, | ||
] | ||
"#, | ||
)?; | ||
|
||
prole | ||
.cd_cmd("my-repo") | ||
.args(["add", "puppy"]) | ||
.status_checked()?; | ||
|
||
prole | ||
.repo_state("my-repo") | ||
.worktrees([ | ||
WorktreeState::new_bare(), | ||
WorktreeState::new("main").branch("main"), | ||
WorktreeState::new("puppy").branch("puppy").file( | ||
"puppy-log", | ||
expect![[r#" | ||
Puppy wuz here | ||
2wice the Pupyluv | ||
"#]], | ||
), | ||
]) | ||
.assert(); | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use command_error::CommandExt; | ||
use test_harness::GitProle; | ||
use test_harness::WorktreeState; | ||
|
||
#[test] | ||
fn config_commands_default() -> miette::Result<()> { | ||
let prole = GitProle::new()?; | ||
prole.setup_worktree_repo("my-repo")?; | ||
|
||
prole | ||
.cd_cmd("my-repo") | ||
.args(["add", "puppy"]) | ||
.status_checked()?; | ||
|
||
prole | ||
.repo_state("my-repo") | ||
.worktrees([ | ||
WorktreeState::new_bare(), | ||
WorktreeState::new("main").branch("main"), | ||
// Wow girl give us nothing! | ||
WorktreeState::new("puppy").branch("puppy").status([]), | ||
]) | ||
.assert(); | ||
|
||
Ok(()) | ||
} |