Commit graph

24 commits

Author SHA1 Message Date
Bryan Davis
831265410e Check for valid git repository in GitInfo::getHeadCommitDate
Ensure that GitInfo::getHead returns a valid value before attempting to
use the git binary to extract a commit date.

Bug: 64948
Change-Id: Ib0d245306842706dbb5d4b9522bb381a5f55526c
2014-05-06 13:19:43 -06:00
Bryan Davis
71fc32c303 Support precomputed data in GitInfo
Support reading git repository information from a JSON file in the cache
directory. When present, this file serves to provide information needed
by getHead, getHeadSHA1, getHeadCommitDate, getCurrentBranch and a new
getRemoteUrl method. A GitInfo::precomputeValues method is also provided
which can generate the cache file for a given GitInfo instance.

This support can be combined with a deployment step to reduce the need
to repeatedly gather information from the .git files/git binary. It also
allows computing information that can be lost when directory structures
differ between deployment staging hosts and hosts running MediaWiki.

This change also adds memoization of computed values for a given GitInfo
instance which may provide a small performance boost even for
deployments which are not using precomputed cache files.

Bug: 53972
Change-Id: I66e058acc5a71e5d82644f85d819f49d6ee9d1e6
2014-05-05 23:50:12 +00:00
umherirrender
7c314de876 Rename some local vars to start with a lowercase letter
Change-Id: I6e5975ed7351c1439eda19afaba5120c6afa50f1
2014-03-15 21:03:05 +00:00
Kunal Mehta
2f6056fab6 GitInfo: Suppress some wrong warnings
It's possible to have a ')' in a .git/config file, but
parse_ini_file will claim that's invalid and display a warning.

Also prevent another warning from occurring if the parse_ini_file
failed and $configArray is null.

Change-Id: Iba54220be266cb885e83cddfa6c8e9782aa77d01
2014-02-06 18:38:25 -08:00
tonythomas01
3afc76a4b5 Used DIRECTORY_SEPARATOR instead of '/' in GitInfo.php
Bug: 46482
Change-Id: If473bf60971b4c1a8c6a657d4cd7dd5a0bad659f
2014-02-07 01:28:05 +01:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
Timo Tijhof
90f6f5840e doc: Fix grammar in GitInfo documentation comment
Change-Id: I67da49398f1281b83700884475d364f6b30c05c8
2013-09-19 18:39:34 +02:00
Alex Monk
a1f1ccee35 Gitweb -> Gitblit
Change-Id: I54387a6ca5ed020e66594d4bf410a042d4ae010f
2013-06-07 23:05:13 +01:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
DaSch
e9e24cbfe7 Add git HEAD date to Special:Version for core and extensions
The patch adds the localised commit date of i) core and ii) extensions
in the Special:Version page tables. It requires the Git version control
system being installed, which is checked during the installation.

Introduces a new parameter for the git binary in DefaultSettings.php:
$wgGitBin = '/usr/bin/git';

Patch authored by DaSch <dasch@daschmedia.de> and updated and fixed
by Wikinaut<mail@tgries.de>.

Bug: 38783
Change-Id: I0931400ecacf91ed2ab4fc7aa46dceac17661768
2013-04-15 20:47:15 +00:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
b5e2ea0298 Do not read /.git if it is a directory
On my windows under eclipse with EGit there is a directory named .git,
but that gives warning, when read with file_get_contents:
Warning: file_get_contents(/.git) [function.file-get-contents]: failed
to open stream: Permission denied in \includes\GitInfo.php on line 49

Follow up Ieb79c0b4

Change-Id: I7c3ba323460a2fd3739d3912ee6420aa29311f4f
2013-02-27 18:43:57 +00:00
Kevin Israel
e951be59c6 Show HEADs for Git 1.7.8+ submodules
I implemented "the gitfile mechanism" in the GitInfo class so it
can access gitdirs for submodules again.

Bug: 44599
Change-Id: Ieb79c0b401a6bb0f5ca8bff98bb382a8c6ffbb01
2013-02-20 11:14:52 -05:00
Alexandre Emsenhuber
15e9fcca01 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iaebd4e253ff3b35b568e9b394231a5691445ac95
2012-05-14 19:59:58 +02:00
saper
8bab490dec $wgGitRepositoryViewers to link to gitweb
My git remote is configured just to be ssh://review/mediawiki/core.git
and I have "review" set up in $HOME/.ssh/config.

Unfortunately, I need to change git remote URLs to make sure
the repository is linked from Special:Version.

This shouldn't be necessary; either we should fallback to the
official MediaWiki git repository or we should add the configuration
option to adapt to local needs.

Change-Id: I2e0b6470c16ec36d0e94cceab844f4a4c4334067
2012-05-06 22:12:14 +02:00
RobLa
576542a314 (bug 36361) Fix git links in Special:Version - removing extra space
Change-Id: I731e163e5f329b78402ed3c6307547c847264587
2012-05-01 22:07:35 -07:00
Simon Walker
6c29ec2921 Add GitViewers hook for extensions to add git viewers to SpecialVersion
This adds a GitViewers hook to GitInfo, and slightly refactors the
$viewers variable to be called through a function so the hook can be
called. This is so extensions can add their own git repository viewer
to the Special:Version git sha field.

Change-Id: Ifc8396984de6a51be85fb63cd9754d57333bde03
2012-04-16 16:57:58 +00:00
Reedy
2fcd7dbf7c Fixup/finish off function parameter documentation
Remove unused variable

Change-Id: I9b19388ded628c170d10ac371882a4debd845ea8
2012-04-13 04:10:46 +01:00
Alexandre Emsenhuber
17ccccda2a Follow-up I5b02aa914916f64492c85ce6dcc3272b6406551a (#4335), also put a link in the debug toolbar.
Now that there is a link on the revision hash in Special:Version, do the same in the debug toolbar.

Change-Id: I953ac70e17e72be68251e3908e164dfa46c68bf5
2012-04-10 22:44:26 +02:00
Antoine Musso
8196f3f11b makes gitweb URL points to full sha1
The URL we are crafting are using a short sha1 (7 chars long) which can
have some good chance of pointing to two different sha1. I have seen git
log to use 8 chars from time to time because of sha1 collisions, 62
occurences outu of 45315 commits as of now.

So to play it safe, this patch makes the URL points to the full sha1.

Follow https://gerrit.wikimedia.org/r/4335
5734eac351 (commit)
9afc1eff1c (merge)

Change-Id: Ic65d0ca89916fe43999b9e3f257d9f322198f9f8
2012-04-10 22:20:15 +02:00
grunny
08165793fc (bug 35751) Fix git revision links on Special:Version
When .git isn't used in the clone URL, links currently break

Change-Id: Ia69e1bfea91ef50c126896b374a083447db4481f
2012-04-06 23:56:26 +10:00
Alexandre Emsenhuber
5734eac351 (bug 35728) Git revisions are now linked on Special:Version
Change-Id: I5b02aa914916f64492c85ce6dcc3272b6406551a
2012-04-05 18:22:48 +02:00
Reedy
b5adbc772c Bug 35583 - GitInfo::isSHA1 returns true for non-sha1 values
Patch by Alexis

Change-Id: I6c69d017d2d6ad1237b0c34ffa8a7ae5fb518178
2012-03-29 15:38:36 +01:00
Daniel Friesen
36b1172147 Add GitInfo class.
This adds GitInfo which is used by Special:Version to get the SHA1 of
the git repo.
It's also useful for development to put blocks of config in
LocalSettings.php that only apply to branches where you are developing
large features:

  if ( GitInfo::currentBranch() == 'myrewriteproject' ) {
    // […]
  }

Change-Id: I2a76662bb40080be6556d4edf60ac6714f36a727
2012-03-23 15:55:12 +01:00