MediaWiki  REL1_22
GitInfo Class Reference

List of all members.

Public Member Functions

 __construct ($dir)
 getCurrentBranch ()
 Return the name of the current branch, or HEAD if not found.
 getHead ()
 Return the HEAD of the repo (without any opening "ref: ")
 getHeadCommitDate ()
 Return the commit date of HEAD entry of the git code repository.
 getHeadSHA1 ()
 Return the SHA1 for the current HEAD of the repo.
 getHeadViewUrl ()
 Get an URL to a web viewer link to the HEAD revision.

Static Public Member Functions

static currentBranch ()
static headSHA1 ()
static headViewUrl ()
static isSHA1 ($str)
 Check if a string looks like a hex encoded SHA1 hash.
static repo ()
 Return a singleton for the repo at $IP.

Static Protected Member Functions

static getViewers ()
 Gets the list of repository viewers.

Protected Attributes

 $basedir
 Location of the .git directory.

Static Protected Attributes

static $repo = null
 Singleton for the repo at $IP.

Static Private Attributes

static $viewers = false
 Map of repo URLs to viewer URLs.

Detailed Description

Definition at line 26 of file GitInfo.php.


Constructor & Destructor Documentation

Parameters:
string$dirThe root directory of the repo where the .git dir can be found

Definition at line 46 of file GitInfo.php.

References $path.


Member Function Documentation

static GitInfo::currentBranch ( ) [static]
See also:
self::getCurrentBranch
Returns:
string

Definition at line 223 of file GitInfo.php.

References repo().

Referenced by MWDebug\getDebugInfo().

Return the name of the current branch, or HEAD if not found.

Returns:
string The branch name, HEAD, or false

Definition at line 153 of file GitInfo.php.

References getHead().

Return the HEAD of the repo (without any opening "ref: ")

Returns:
string The HEAD

Definition at line 84 of file GitInfo.php.

Referenced by getCurrentBranch(), and getHeadSHA1().

Return the commit date of HEAD entry of the git code repository.

Since:
1.22
Returns:
int|bool Commit date (UNIX timestamp) or false

Definition at line 129 of file GitInfo.php.

References array(), global, wfEscapeShellArg(), and wfShellExec().

Return the SHA1 for the current HEAD of the repo.

Returns:
string A SHA1 or false

Definition at line 104 of file GitInfo.php.

References getHead().

Referenced by getHeadViewUrl().

Get an URL to a web viewer link to the HEAD revision.

Returns:
string|bool string if a URL is available or false otherwise.

Definition at line 167 of file GitInfo.php.

References $matches, $repo, array(), as, and getHeadSHA1().

static GitInfo::getViewers ( ) [static, protected]

Gets the list of repository viewers.

Returns:
array

Definition at line 239 of file GitInfo.php.

References $viewers, array(), global, and wfRunHooks().

static GitInfo::headSHA1 ( ) [static]
See also:
self::getHeadSHA1
Returns:
string

Definition at line 215 of file GitInfo.php.

References repo().

Referenced by MWDebug\getDebugInfo().

static GitInfo::headViewUrl ( ) [static]
See also:
self::getHeadViewUrl()
Returns:
bool|string

Definition at line 231 of file GitInfo.php.

References repo().

Referenced by MWDebug\getDebugInfo().

static GitInfo::isSHA1 ( str) [static]

Check if a string looks like a hex encoded SHA1 hash.

Parameters:
string$strThe string to check
Returns:
bool Whether or not the string looks like a SHA1

Definition at line 76 of file GitInfo.php.

static GitInfo::repo ( ) [static]

Return a singleton for the repo at $IP.

Returns:
GitInfo

Definition at line 62 of file GitInfo.php.

References $IP, $repo, and global.

Referenced by currentBranch(), headSHA1(), and headViewUrl().


Member Data Documentation

GitInfo::$basedir [protected]

Location of the .git directory.

Definition at line 36 of file GitInfo.php.

GitInfo::$repo = null [static, protected]

Singleton for the repo at $IP.

Definition at line 31 of file GitInfo.php.

Referenced by getHeadViewUrl(), and repo().

GitInfo::$viewers = false [static, private]

Map of repo URLs to viewer URLs.

Access via static method getViewers().

Definition at line 41 of file GitInfo.php.

Referenced by getViewers().


The documentation for this class was generated from the following file: