From 4227dadb9c761b471ca21dc5c4cd2f6ce85d2562 Mon Sep 17 00:00:00 2001 From: Miriam Date: Sat, 9 May 2026 10:37:39 +0200 Subject: [PATCH 1/2] feat: add thin typed wrappers for set/get('branch',..) on the host --- src/Host/Host.php | 11 +++++++++++ tests/src/Host/HostTest.php | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Host/Host.php b/src/Host/Host.php index f4a476ea4..290465e2c 100644 --- a/src/Host/Host.php +++ b/src/Host/Host.php @@ -200,6 +200,17 @@ public function getDeployPath(): ?string return $this->config->get('deploy_path', null); } + public function setBranch(string $branch): self + { + $this->config->set('branch', $branch); + return $this; + } + + public function getBranch(): ?string + { + return $this->config->get('branch', null); + } + public function setLabels(array $labels): self { $this->config->set('labels', $labels); diff --git a/tests/src/Host/HostTest.php b/tests/src/Host/HostTest.php index 11aee0776..2a6a3bb06 100644 --- a/tests/src/Host/HostTest.php +++ b/tests/src/Host/HostTest.php @@ -34,7 +34,8 @@ public function testHost() ->setConfigFile('~/.ssh/config') ->setIdentityFile('~/.ssh/id_rsa') ->setForwardAgent(true) - ->setSshMultiplexing(true); + ->setSshMultiplexing(true) + ->setBranch('develop'); self::assertEquals('host', $host->getAlias()); self::assertStringContainsString('host', $host->getTag()); @@ -45,6 +46,7 @@ public function testHost() self::assertEquals('~/.ssh/id_rsa', $host->getIdentityFile()); self::assertEquals(true, $host->getForwardAgent()); self::assertEquals(true, $host->getSshMultiplexing()); + self::assertEquals('develop', $host->getBranch()); } public function testConfigurationAccessor() From 55531c3ec4fd3c9c6730b3ec1c8c98ee14a729d8 Mon Sep 17 00:00:00 2001 From: Miriam Date: Sat, 9 May 2026 10:38:58 +0200 Subject: [PATCH 2/2] feat(setBranch/getBranch): add documentation --- docs/hosts.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/hosts.md b/docs/hosts.md index 69fa54e0c..bd5f8d953 100644 --- a/docs/hosts.md +++ b/docs/hosts.md @@ -71,7 +71,8 @@ The typed setter methods give better IDE autocompletion: ```php host('example.org') ->setHostname('example.cloud.google.com') - ->setRemoteUser('deployer'); + ->setRemoteUser('deployer') + ->setBranch('production'); ``` --- @@ -130,6 +131,7 @@ set('default_selector', "stage=prod&role=web,role=special"); | **`ssh_multiplexing`** | Enable SSH multiplexing for performance. Default is `true`. | | **`shell`** | Shell to use. Default is `bash -ls`. | | **`deploy_path`** | Directory for deployments. E.g., `~/myapp`. | +| **`branch`** | Git branch to deploy for this host. Overrides the global `branch` config when set. Use `setBranch()` for a typed setter. | | **`labels`** | Key-value pairs for host selection. | | **`ssh_arguments`** | Additional SSH options. E.g., `['-o UserKnownHostsFile=/dev/null']`. | | **`ssh_control_path`** | Control path for SSH multiplexing. Default is `~/.ssh/%C` or `/dev/shm/%C` in CI environments. |