-
Notifications
You must be signed in to change notification settings - Fork 0
feat(worktree): create and manage development worktrees #14
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
Open
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0125d13
fix(docker): read database credentials from the compose variables
chrisdeeming 1bb08b0
feat(worktree): add path resolution, git helpers and registry
chrisdeeming a18276d
feat(worktree): add creation and removal with safety checks
chrisdeeming c73149a
feat(init): install Composer dependencies automatically
chrisdeeming fd0dad5
feat(cli): add xf worktree
chrisdeeming fe74651
fix(init): complete the setup chain for existing directories
chrisdeeming ee201a6
fix(worktree): remove containers and volumes with the worktree
chrisdeeming dbebddd
feat(worktree): clone the source environment by default
chrisdeeming 2623559
fix(worktree): do not report admin credentials for a cloned worktree
chrisdeeming 17dd035
feat(worktree): name worktrees after the branch's last segment
chrisdeeming 7c22db6
fix(worktree): point a cloned board at its own URL
chrisdeeming 67f7891
feat(worktree): label a cloned board with the worktree name
chrisdeeming 1277810
docs(readme): document worktrees and automatic Composer install
chrisdeeming fe1ffde
fix(config): guard Init against concurrent callers
chrisdeeming 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestShouldRunComposer(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| files []string | ||
| want bool | ||
| }{ | ||
| { | ||
| name: "composer.json present", | ||
| files: []string{"composer.json"}, | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "composer.json and lock present", | ||
| files: []string{"composer.json", "composer.lock"}, | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "no composer files", | ||
| files: nil, | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "lock without json is not a composer project", | ||
| files: []string{"composer.lock"}, | ||
| want: false, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| dir := t.TempDir() | ||
|
|
||
| for _, name := range tt.files { | ||
| if err := os.WriteFile(filepath.Join(dir, name), []byte("{}"), 0o600); err != nil { | ||
| t.Fatalf("write %s: %v", name, err) | ||
| } | ||
| } | ||
|
|
||
| if got := shouldRunComposer(dir); got != tt.want { | ||
| t.Errorf("shouldRunComposer = %v, want %v", got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| // TestShouldRunComposerIgnoresDirectory guards against a directory named | ||
| // composer.json being mistaken for a manifest. | ||
| func TestShouldRunComposerIgnoresDirectory(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| dir := t.TempDir() | ||
|
|
||
| if err := os.MkdirAll(filepath.Join(dir, "composer.json"), 0o750); err != nil { | ||
| t.Fatalf("mkdir: %v", err) | ||
| } | ||
|
|
||
| if shouldRunComposer(dir) { | ||
| t.Error("a directory named composer.json must not count as a manifest") | ||
| } | ||
| } |
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
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.