Skip to content

Commit

Permalink
Gitlab https as well (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm authored Nov 16, 2024
1 parent 043ea4d commit e884733
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ToCloneUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public static function fromRepoAndToken(string $repo, string $authToken) : strin
$repo_parsed["path"]
);
break;

case 'www.gitlab.com':
case 'gitlab.com':
$repo_path = sprintf('https://oauth2:%[email protected]%s', $authToken, $repo_parsed["path"]);
break;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions tests/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public static function provideAllCases() : array
'token123',
'https://x-access-token:[email protected]/user/repo.git',
],
[
'https://gitlab.com/user/repo.git',
'token123',
'https://oauth2:[email protected]/user/repo.git',
],
[
'https://www.gitlab.com/user/repo.git',
'token123',
'https://oauth2:[email protected]/user/repo.git',
],
];
}
}

0 comments on commit e884733

Please sign in to comment.