Block8/PHPCI — pull request #501 by Libbux (2014-07-15 16:55:11+00:00)
Title: Fix issue #484 - Correct GitLab commit/branch links when reference URL has a port number

This is another attempt at pull request #489. These changes are based on dc/services-layer (pull request #492) as of commit dfb992de483cd9792d70d159cfed6464bce91f89.

This pull request fixes issue #484, which affects the generation of links to commits and branches on the project page.

When a project is added using the `ssh://foo@git.example.com:port/user/repo.git` form, the reference URL stored in the database includes the port number at the beginning. This is necessary as the port stored in the reference URL is used for cloning the repository, but it causes links to commits and branches on the project page (pictured below)

![screen shot 2014-07-10 at 01 29 33 am](https://cloud.githubusercontent.com/assets/2374543/3533078/5471dc88-07c9-11e4-88a9-552e4e52497e.png)

to point to `http://git.example.com/port/user/repo/commit|branch` (note that the port is included in the URL, thus malforming it and causing it to 404).

This pull request solves the problem by adding an *optional* boolean parameter to the `PHPCI\Model\Base\getReference()` method (`Model/Base/ProjectBase.php`).

If the parameter is set to `false` or simply not included (as to not inhibit the functionality of the rest of the codebase relying on this method), the method will return the reference URL *with* the port prefix, as the assumption is that the rest of the codebase still needs to be able to access the actual reference URL properly. However, when the parameter is set to `true`, the method returns a "link friendly" version which does not include the port number prefix.