Gogs.GitMock (gogs v0.6.0)
Mock functions to simulate Git commands. Sadly, this is necessary until we figure out how to get write-access on GitHub CI.
Link to this section Summary
Link to this section Functions
clone(url)
@spec clone(String.t()) :: {:ok, %Git.Repository{path: term()}} | {:error, %Git.Error{ __exception__: term(), args: term(), code: term(), command: term(), message: term() }}
clone/1
(mock) returns the path of the existing test-repo
so that no remote cloning occurs. This is needed for CI and
is used in downstream tests to speed up suite execution.
## Examples iex> GitMock.clone("ssh://gogs-server.fly.dev:10022/myorg/public-repo.git") {:ok, %Git.Repository{path: "/path/to/public-repo"}}
iex> GitMock.clone("any-url-containing-the-word-error-to-trigger-failure") {:error, %Git.Error{message: "git clone error (mock)"}}
push(repository, args)
push/1
(mock) pushes the latest commits on the current branch
to the Gogs remote repository.
## Examples iex> GitMock.push("my-repo") {:ok, "To ssh://gogs-server.fly.dev:10022/myorg/my-repo.git "}