Index

SSHRepository

MMO\git\helpers · 1 symbol · generated 5 Oct 2026

class

SSHRepository

SSHRepository.php:18

A Repository living on another host: every command is run over an existing SSH connection instead of as a local process.

class MMO\git\helpers\SSHRepository extends MMO\git\helpers\Repository
Namespace
MMO\git\helpers
Extends
Repository
$ssh = new SSH('deploy', 'example.com', privateKey: '{root}/keys/deploy'); $ssh->connect(); $repo = new SSHRepository($ssh, '/var/www/project');

Properties1

ssh

readonly
readonly MMO\core\server\SSH $ssh
Type
SSH

Methods9

exec($cmd, $throwOnExitCode, $exitCode)

SSHRepository.php:45
function exec(string $cmd, bool $throwOnExitCode = true, ?int &$exitCode = null): string
$cmdstring
$throwOnExitCode = truebool
$exitCode = nullnull | int
returnsstring

pullAsync($remote, $branch, $options)

SSHRepository.php:79
function pullAsync(string $remote = '', string $branch = '', string $options = '-q'): MMO\core\server\SSHStream
$remote = ''string
$branch = ''string
$options = '-q'string
returnsSSHStream

serialize($path, $serializer)

SSHRepository.php:33

The connection cannot be rebuilt from the folder alone, so it is serialized alongside it -- the inherited

function serialize(string $path, callable $serializer): array
See
Repository::serialize would produce something that unserializes into a broken object.
$pathstring
$serializercallable
returnsarray

unserialize($data, $path, $instances)

SSHRepository.php:37
function unserialize( array $data, string $path, Psr\Container\ContainerInterface|array &$instances ): void
$dataarray
$pathstring
$instancesContainerInterface | array
returnsvoid

__construct($ssh, $filename, $status, $origin)

SSHRepository.php:21
function __construct( MMO\core\server\SSH $ssh, string $filename, int $status = 0, ?string $origin = null )
$sshSSH
$filenamestring
$status = 0int
$origin = nullnull | string
Inherited members (111)
ConstantsDeclared byDescription
CAN_BE_ADDEDiEntry
CAN_BE_COMMITEDiEntry
COMMIT_CHANGEDiEntry
ENTRY_STATUSiEntry
INDEX_ADDEDiEntry
INDEX_COPIEDiEntry
INDEX_DELETEDiEntry
INDEX_IGNOREDiEntry
INDEX_MODIFIEDiEntry
INDEX_RENAMEDiEntry
INDEX_UNMERGEDiEntry
INDEX_UNTRACKEDiEntry
MODULE_STATUSiEntry
TRACKED_CHANGESiEntry
UNKNOWN_ERRORiEntry
UNTRACKED_CHANGESiEntry
WORKTREE_ADDEDiEntry
WORKTREE_COPIEDiEntry
WORKTREE_DELETEDiEntry
WORKTREE_IGNOREDiEntry
WORKTREE_MODIFIEDiEntry
WORKTREE_RENAMEDiEntry
WORKTREE_UNMERGEDiEntry
WORKTREE_UNTRACKEDiEntry
PropertiesDeclared byDescription
aheadRepository
behindRepository
binRepository
branchRepository
entriesRepository
filenameaEntry
idRepository
originaEntry
parentaEntry
runAsSudoRepository
statusaEntry
STATUS_TEXTaEntry
timeoutRepository
upstreamRepository
validRepository
MethodsDeclared byDescription
add($file, $option)RepositoryRuns a git add call.
addStatus($flags)aEntry
addTag($tag, $message)RepositoryAdd an annotated tag at the current position.
archive($ref, $folder, $options)RepositoryExport a ref's tree into a folder: tracked files only, no .git, nothing the working tree happens to carry.
assertValid()Repository
checkout($branch, $create)RepositoryRuns a git checkout call.
checkoutAndPull($branch)RepositoryCheckout a branch, then pull it when it is behind its upstream.
clearEntries()Repository
clearStatus($flags)aEntry
commit($message, $options)RepositoryRuns a git commit call.
createBranch($branch)Repository
debugName()aEntry
deleteBranch($branch, $force)Repository
Escape($arg)RepositoryEscape one argument for the shell.
execTrim($cmd, $throwOnExitCode, $exitCode)Repository
fetch($opts)Repository
getAhead()Repository
getBehind()Repository
getBranch()RepositoryThe current branch, or -- on a detached HEAD, which has no branch -- the short commit hash.
getChangedEntries()Repository
getCommit($format)Repository
getCommitHash($short)Repository
getCommitVersion()RepositoryA version for the current commit, derived from the most recent tag.
getEntriesStatus()Repository
getEntriesStatusText($sep)Repository
getEntry($relativeFilename)Repository
getFetchRemotes()Repository
getFilename()aEntry
getModuleStatus()Repository
getModuleStatusText($sep)Repository
getOrigin()aEntry
getParent()aEntry
getPushRemotes()Repository
getRemoteName($url, $fetch)RepositoryThe name of the remote serving $url.
getRemotes($direction)RepositoryThe configured remotes.
getRevisionCount($branch1, $branch2)RepositoryHow many commits $branch2 has that $branch1 does not.
getStatus()aEntry
getStatusText($sep)aEntry
getUpstream()Repository
getUpstreamOf($branch)RepositoryThe remote-tracking branch a local branch follows, e.g.
hasChanges()Repository
hasDiff($filter, $files, $ref)RepositoryCheck whether there are differences against $ref.
init()Repository
isClean()Repository
isDetached()Repository
isValidRemote($url)Repository
list()RepositoryEvery tracked entry, recursing into the submodules.
listBranches($incLocal, $incRemote)RepositoryRuns a git branch call.
listModules()RepositoryThe submodules declared by this repository.
listTags($pattern)RepositoryList the repository tags, most recent version first.
makeEntry($file, $status, $sub, $origin)RepositoryBuild (or refresh) one entry of update, choosing File or Module from the <sub> field git reported.
merge($branch, $options)RepositoryRuns a git merge call.
mtime($filename, $options)Repository
pull($remote, $branch, $options)RepositoryPull a specific branch from a remote.
push($remote, $branch, $options)RepositoryPush a specific branch (or all branches) to a remote.
pushMasterVersion($masterBranch, $where, $defaultVersion)RepositoryMerge the current branch into the master branch and tag the version.
realCommand($cmd)Repository
relativeFilename()aEntryThe filename relative to the repository this entry belongs to.
remove($file, $option)Repository
resolve($ref)RepositoryResolve any commit-ish (a branch, a tag, HEAD~2, ...) to its full hash.
restoreTime($filename, $options)Repository
setOrigin($origin)aEntry
setParent($parent)aEntry
setStatus($flags, $origin)aEntryReplace the status flags, and -- because git reports a rename's previous path alongside its status -- optionally the origin in the same call.
show($revision, $filename)RepositoryShow the content of a file from another branch/revision.
status()Repository
StatusFlags($flags)aEntryRead the two-character <XY> field of a git status --porcelain=2 entry.
StatusModuleFlags($flags)aEntryRead the four-character <sub> field of a git status --porcelain=2 entry (N... for a plain file, S<c><m><u> for a submodule).
StatusText($status, $sep)aEntryConvert git status constants to text.
tagVersion($message, $where, $inc, $default)RepositoryTag the current commit with the next version after the most recent v* tag.
test($cmd)Repository
update()RepositoryRead git status into this repository's flags and entries.