Index

Module

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

class

Module

Module.php:13

A submodule: a full Repository that also happens to be an entry of another one.

class MMO\git\helpers\Module extends MMO\git\helpers\Repository
Namespace
MMO\git\helpers
Extends
Repository
See
aEntry::relativeFilename answers relative to the superproject.
Everything a repository can do, a submodule can do -- it just additionally knows its parent, so

Index

addToCommit($option)Update the superproject's recorded commit for this submodule.
serialize($path, $serializer)A submodule only means something together with its superproject, so the parent travels with it -- the plain Repository::serialize would drop it and rebuild an unrelated standalone repository.
unserialize($data, $path, $instances)
__construct($parent, $filename, $status, $origin)

Methods4

addToCommit($option)

Module.php:49

Update the superproject's recorded commit for this submodule. @return string

function addToCommit(string $option = ''): string
$option = ''string
returnsstring

serialize($path, $serializer)

Module.php:32

A submodule only means something together with its superproject, so the parent travels with it -- the plain Repository::serialize would drop it and rebuild an unrelated standalone repository.

function serialize(string $path, callable $serializer): array
$pathstring
$serializercallable
returnsarray

unserialize($data, $path, $instances)

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

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

Module.php:20
function __construct( MMO\git\helpers\Repository $parent, string $filename, int $status = 0, ?string $origin = null )
$parentRepositorythe superproject
$filenamestringthe absolute filename of the submodule's folder
$status = 0int
$origin = nullnull | stringthe previous path, when git reported a rename
Inherited members (114)
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.
exec($cmd, $throwOnExitCode, $exitCode)RepositoryRun a git command in the repository folder.
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
isValid()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
setFolder($folder)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.