Skip to content

Commit e68c9eb

Browse files
committed
fix(worktree): slugify the worktree name for docker compose
1 parent 6a0086a commit e68c9eb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎.castor/worktree.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace worktree;
44

5+
use function Castor\slug;
56
use function Castor\variable;
67
use function docker\get_port_specs;
78

@@ -31,7 +32,8 @@ function get_worktree_name(?string $rootDir = null): ?string
3132
return null;
3233
}
3334

34-
return strtolower(basename(rtrim($gitdir, '/'))) ?: null;
35+
// Docker Compose rejects dots and most symbols in a project name, which a directory name may hold
36+
return strtolower(slug(basename(rtrim($gitdir, '/')))) ?: null;
3537
}
3638

3739
/** @return array<string, int> */

0 commit comments

Comments
 (0)