MediaWiki
master
|
Public Member Functions | |
__construct ( $repoDir, $usePrecomputed=true) | |
cacheIsComplete () | |
Check to see if the current cache is fully populated. More... | |
getCurrentBranch () | |
Get the name of the current branch, or HEAD if not found. More... | |
getHead () | |
Get the HEAD of the repo (without any opening "ref: ") More... | |
getHeadCommitDate () | |
Get the commit date of HEAD entry of the git code repository. More... | |
getHeadSHA1 () | |
Get the SHA1 for the current HEAD of the repo. More... | |
getHeadViewUrl () | |
Get an URL to a web viewer link to the HEAD revision. More... | |
precomputeValues () | |
Precompute and cache git information. More... | |
Static Public Member Functions | |
static | currentBranch () |
static | headSHA1 () |
static | headViewUrl () |
static | isSHA1 ( $str) |
Check if a string looks like a hex encoded SHA1 hash. More... | |
static | repo () |
Get the singleton for the repo at MW_INSTALL_PATH. More... | |
Protected Member Functions | |
getRemoteUrl () | |
Get the URL of the remote origin. More... | |
Protected Attributes | |
$basedir | |
Location of the .git directory. More... | |
$cache = [] | |
Cached git information. More... | |
$cacheFile | |
Path to JSON cache file for pre-computed git information. More... | |
$repoDir | |
Location of the repository. More... | |
Static Protected Attributes | |
static | $repo = null |
Singleton for the repo at $IP. More... | |
Definition at line 40 of file GitInfo.php.
GitInfo::__construct | ( | $repoDir, | |
$usePrecomputed = true |
|||
) |
string | $repoDir | The root directory of the repo where .git can be found |
bool | $usePrecomputed | Use precomputed information if available |
Definition at line 96 of file GitInfo.php.
References $path, $repoDir, cacheIsComplete(), and FormatJson\decode().
GitInfo::cacheIsComplete | ( | ) |
Check to see if the current cache is fully populated.
Note: This method is public only to make unit testing easier. There's really no strong reason that anything other than a test should want to call this method.
Definition at line 389 of file GitInfo.php.
Referenced by __construct(), and precomputeValues().
|
static |
Definition at line 445 of file GitInfo.php.
References repo().
Referenced by MWDebug\getDebugInfo().
GitInfo::getCurrentBranch | ( | ) |
Get the name of the current branch, or HEAD if not found.
Definition at line 306 of file GitInfo.php.
References getHead().
Referenced by precomputeValues().
GitInfo::getHead | ( | ) |
Get the HEAD of the repo (without any opening "ref: ")
Definition at line 209 of file GitInfo.php.
Referenced by getCurrentBranch(), getHeadCommitDate(), getHeadSHA1(), and precomputeValues().
GitInfo::getHeadCommitDate | ( | ) |
Get the commit date of HEAD entry of the git code repository.
Definition at line 265 of file GitInfo.php.
References getHead().
Referenced by precomputeValues().
GitInfo::getHeadSHA1 | ( | ) |
Get the SHA1 for the current HEAD of the repo.
Definition at line 233 of file GitInfo.php.
References $matches, and getHead().
Referenced by getHeadViewUrl(), and precomputeValues().
GitInfo::getHeadViewUrl | ( | ) |
Get an URL to a web viewer link to the HEAD revision.
Definition at line 324 of file GitInfo.php.
References $matches, $repo, getHeadSHA1(), and getRemoteUrl().
|
protected |
Get the URL of the remote origin.
Definition at line 350 of file GitInfo.php.
Referenced by getHeadViewUrl(), and precomputeValues().
|
static |
Definition at line 437 of file GitInfo.php.
References repo().
Referenced by MWDebug\getDebugInfo().
|
static |
Definition at line 453 of file GitInfo.php.
References repo().
Referenced by MWDebug\getDebugInfo().
|
static |
Check if a string looks like a hex encoded SHA1 hash.
string | $str | The string to check |
Definition at line 200 of file GitInfo.php.
Referenced by MWDebug\getDebugInfo().
GitInfo::precomputeValues | ( | ) |
Precompute and cache git information.
Creates a JSON file in the cache directory associated with this GitInfo instance. This cache file will be used by subsequent GitInfo objects referencing the same directory to avoid needing to examine the .git directory again.
Definition at line 406 of file GitInfo.php.
References cacheIsComplete(), FormatJson\encode(), getCurrentBranch(), getHead(), getHeadCommitDate(), getHeadSHA1(), getRemoteUrl(), and wfMkdirParents().
|
static |
Get the singleton for the repo at MW_INSTALL_PATH.
Definition at line 187 of file GitInfo.php.
References $repo.
Referenced by currentBranch(), headSHA1(), and headViewUrl().
|
protected |
Location of the .git directory.
Definition at line 50 of file GitInfo.php.
|
protected |
Cached git information.
Definition at line 65 of file GitInfo.php.
|
protected |
Path to JSON cache file for pre-computed git information.
Definition at line 60 of file GitInfo.php.
|
staticprotected |
Singleton for the repo at $IP.
Definition at line 45 of file GitInfo.php.
Referenced by getHeadViewUrl(), and repo().
|
protected |