fix(git): handle additional repository URL cases for 'tangled' and improve branch assignment logic

This commit is contained in:
Andras Bacsai 2025-09-30 12:22:57 +02:00
parent a9e1d4cb79
commit 8e7c869d23

View file

@ -176,13 +176,16 @@ public function loadBranch()
str($this->repository_url)->startsWith('http://')) && str($this->repository_url)->startsWith('http://')) &&
! str($this->repository_url)->endsWith('.git') && ! str($this->repository_url)->endsWith('.git') &&
(! str($this->repository_url)->contains('github.com') || (! str($this->repository_url)->contains('github.com') ||
! str($this->repository_url)->contains('git.sr.ht')) ! str($this->repository_url)->contains('git.sr.ht')) &&
! str($this->repository_url)->contains('tangled')
) { ) {
$this->repository_url = $this->repository_url.'.git'; $this->repository_url = $this->repository_url.'.git';
} }
if (str($this->repository_url)->contains('github.com') && str($this->repository_url)->endsWith('.git')) { if (str($this->repository_url)->contains('github.com') && str($this->repository_url)->endsWith('.git')) {
$this->repository_url = str($this->repository_url)->beforeLast('.git')->value(); $this->repository_url = str($this->repository_url)->beforeLast('.git')->value();
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -190,6 +193,9 @@ public function loadBranch()
$this->branchFound = false; $this->branchFound = false;
$this->getGitSource(); $this->getGitSource();
$this->getBranch(); $this->getBranch();
if (str($this->repository_url)->contains('tangled')) {
$this->git_branch = 'master';
}
$this->selectedBranch = $this->git_branch; $this->selectedBranch = $this->git_branch;
} catch (\Throwable $e) { } catch (\Throwable $e) {
if ($this->rate_limit_remaining == 0) { if ($this->rate_limit_remaining == 0) {