Skip to content

Repository branch compare doesn't work if the branch name contains slashes. #826

Open
@vekien

Description

@vekien

Issue

If a branch name has slashes, the compare function does not work and throws an error

Replicate:

<?php

require __DIR__ . "/vendor/autoload.php";

use Gitlab\Client;

$client = new Client();
$client->setUrl("url");
$client->authenticate("token", Client::AUTH_HTTP_TOKEN);

$comparison = $client->repositories()->compare(
    123,
    "fix/branch_name",
    "develop"
);

print_r($comparison);

Thrown:

Fatal error: Uncaught Gitlab\Exception\RuntimeException: 404 Ref Not Found in gitlab-test/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php:78
Stack trace:
#0 gitlab-test/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php(53): Gitlab\HttpClient\Plugin\ExceptionThrower::createException(404, '404 Ref Not Fou...')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions