From e93e986b12b3b8338e95fcad617099ce7354b826 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:07:50 -0300 Subject: [PATCH 01/12] Updating dependencies --- composer.json | 14 ++-- composer.lock | 225 ++++++++++++++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 106 deletions(-) diff --git a/composer.json b/composer.json index 7d626a6..b5a37ab 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,14 @@ { "require": { - "silex/silex": "1.0.*", - "twig/twig": "1.9.*", - "symfony/twig-bridge": "2.1.*", - "symfony/filesystem": "2.1.*", - "klaussilveira/gitter": "dev-master" + "silex/silex": "1.0.*@dev", + "twig/twig": "1.12.*", + "symfony/twig-bridge": "2.2.*", + "symfony/filesystem": "2.2.*", + "klaussilveira/gitter": "0.1.3" }, "require-dev": { - "symfony/browser-kit": "2.1.*", - "symfony/css-selector": "2.1.*", + "symfony/browser-kit": "2.2.*", + "symfony/css-selector": "2.2.*", "phpunit/phpunit": "3.7.*", "phpmd/phpmd": "1.4.*", "phploc/phploc": "1.7.*" diff --git a/composer.lock b/composer.lock index 4f7f46a..a057fed 100644 --- a/composer.lock +++ b/composer.lock @@ -1,27 +1,27 @@ { - "hash": "23b42eb82a97fc586f9c703879c08ac9", + "hash": "4d7bf1d32c612b74b8e7afdb6a9ada2d", "packages": [ { "name": "klaussilveira/gitter", - "version": "dev-master", + "version": "0.1.3", "source": { "type": "git", "url": "https://github.com/klaussilveira/gitter.git", - "reference": "9e30a927d1edf28c3ee844b7d0657c4a9535cd12" + "reference": "0.1.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/klaussilveira/gitter/zipball/9e30a927d1edf28c3ee844b7d0657c4a9535cd12", - "reference": "9e30a927d1edf28c3ee844b7d0657c4a9535cd12", + "url": "https://api.github.com/repos/klaussilveira/gitter/zipball/0.1.3", + "reference": "0.1.3", "shasum": "" }, "require": { "php": ">=5.3.0", - "symfony/process": ">=2.1" + "symfony/process": ">=2.2" }, "require-dev": { "phpunit/phpunit": ">=3.7.1", - "symfony/filesystem": ">=2.1" + "symfony/filesystem": ">=2.2" }, "type": "library", "autoload": { @@ -47,7 +47,7 @@ "git", "vcs" ], - "time": "2013-02-19 13:59:07" + "time": "2013-03-29 01:18:34" }, { "name": "pimple/pimple", @@ -139,12 +139,12 @@ "source": { "type": "git", "url": "https://github.com/fabpot/Silex.git", - "reference": "59e7dbd338b5caba9879ae11524da4a5905f80c1" + "reference": "a5cb55ced63ece76550de1599ddcc60719373594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Silex/zipball/59e7dbd338b5caba9879ae11524da4a5905f80c1", - "reference": "59e7dbd338b5caba9879ae11524da4a5905f80c1", + "url": "https://api.github.com/repos/fabpot/Silex/zipball/a5cb55ced63ece76550de1599ddcc60719373594", + "reference": "a5cb55ced63ece76550de1599ddcc60719373594", "shasum": "" }, "require": { @@ -212,7 +212,7 @@ "keywords": [ "microframework" ], - "time": "2013-03-08 16:56:52" + "time": "2013-03-27 09:31:32" }, { "name": "symfony/event-dispatcher", @@ -270,26 +270,31 @@ }, { "name": "symfony/filesystem", - "version": "2.1.x-dev", + "version": "2.2.x-dev", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "v2.1.8" + "reference": "v2.2.0-RC3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.1.8", - "reference": "v2.1.8", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.0-RC3", + "reference": "v2.2.0-RC3", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, "autoload": { "psr-0": { - "Symfony\\Component\\Filesystem": "" + "Symfony\\Component\\Filesystem\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -308,7 +313,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2013-01-09 08:51:07" + "time": "2013-01-17 15:25:59" }, { "name": "symfony/http-foundation", @@ -317,12 +322,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "d154b0d9a6b5dac26413a314df1846abe197aaef" + "reference": "6af424d4fee81987e76bc76aa4e811859ca70bac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/d154b0d9a6b5dac26413a314df1846abe197aaef", - "reference": "d154b0d9a6b5dac26413a314df1846abe197aaef", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/6af424d4fee81987e76bc76aa4e811859ca70bac", + "reference": "6af424d4fee81987e76bc76aa4e811859ca70bac", "shasum": "" }, "require": { @@ -358,7 +363,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2013-03-01 10:42:10" + "time": "2013-03-23 07:49:54" }, { "name": "symfony/http-kernel", @@ -367,12 +372,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "2a354f11ea59f58024b087c371dd1d4f9246dc86" + "reference": "3bfc8fda577fb671b2d9395a59fbc87f449fa61f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/2a354f11ea59f58024b087c371dd1d4f9246dc86", - "reference": "2a354f11ea59f58024b087c371dd1d4f9246dc86", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/3bfc8fda577fb671b2d9395a59fbc87f449fa61f", + "reference": "3bfc8fda577fb671b2d9395a59fbc87f449fa61f", "shasum": "" }, "require": { @@ -427,7 +432,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2013-03-11 17:23:12" + "time": "2013-03-23 10:43:44" }, { "name": "symfony/process", @@ -436,12 +441,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "6ebe4ba544cfc0dd25bfe49402da4d5267ee1b43" + "reference": "46b24c5905096914d467b769027e36433c7b5421" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/6ebe4ba544cfc0dd25bfe49402da4d5267ee1b43", - "reference": "6ebe4ba544cfc0dd25bfe49402da4d5267ee1b43", + "url": "https://api.github.com/repos/symfony/Process/zipball/46b24c5905096914d467b769027e36433c7b5421", + "reference": "46b24c5905096914d467b769027e36433c7b5421", "shasum": "" }, "require": { @@ -474,7 +479,7 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-02-18 21:28:20" + "time": "2013-03-23 08:06:49" }, { "name": "symfony/routing", @@ -483,12 +488,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "3a97436e581bae44d0eec454a74bbb4f93593e78" + "reference": "a8599d5735c5f1f994cfbf91f59851add9c9f627" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/3a97436e581bae44d0eec454a74bbb4f93593e78", - "reference": "3a97436e581bae44d0eec454a74bbb4f93593e78", + "url": "https://api.github.com/repos/symfony/Routing/zipball/a8599d5735c5f1f994cfbf91f59851add9c9f627", + "reference": "a8599d5735c5f1f994cfbf91f59851add9c9f627", "shasum": "" }, "require": { @@ -532,47 +537,54 @@ ], "description": "Symfony Routing Component", "homepage": "http://symfony.com", - "time": "2013-03-06 19:31:19" + "time": "2013-03-14 09:39:13" }, { "name": "symfony/twig-bridge", - "version": "2.1.x-dev", + "version": "2.2.x-dev", "target-dir": "Symfony/Bridge/Twig", "source": { "type": "git", "url": "https://github.com/symfony/TwigBridge.git", - "reference": "083b7b93d43315f6d23b049f76527da2d64d92c6" + "reference": "50bbc4a10d34a71325b58940c4887726b8a30841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/TwigBridge/zipball/083b7b93d43315f6d23b049f76527da2d64d92c6", - "reference": "083b7b93d43315f6d23b049f76527da2d64d92c6", + "url": "https://api.github.com/repos/symfony/TwigBridge/zipball/50bbc4a10d34a71325b58940c4887726b8a30841", + "reference": "50bbc4a10d34a71325b58940c4887726b8a30841", "shasum": "" }, "require": { "php": ">=5.3.3", - "twig/twig": ">=1.9.1,<2.0-dev" + "twig/twig": ">=1.11.0,<2.0" }, "require-dev": { - "symfony/form": "2.1.*", - "symfony/routing": "2.1.*", - "symfony/security": "2.1.*", - "symfony/templating": "2.1.*", - "symfony/translation": "2.1.*", - "symfony/yaml": "2.1.*" + "symfony/form": "2.2.*", + "symfony/http-kernel": ">=2.2,<2.3-dev", + "symfony/routing": ">=2.2,<2.3-dev", + "symfony/security": ">=2.0,<2.3-dev", + "symfony/templating": ">=2.1,<3.0", + "symfony/translation": ">=2.0,<2.3-dev", + "symfony/yaml": ">=2.0,<3.0" }, "suggest": { - "symfony/form": "2.1.*", - "symfony/routing": "2.1.*", - "symfony/security": "2.1.*", - "symfony/templating": "2.1.*", - "symfony/translation": "2.1.*", - "symfony/yaml": "2.1.*" + "symfony/form": "2.2.*", + "symfony/http-kernel": "2.2.*", + "symfony/routing": "2.2.*", + "symfony/security": "2.2.*", + "symfony/templating": "2.2.*", + "symfony/translation": "2.2.*", + "symfony/yaml": "2.2.*" }, "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, "autoload": { "psr-0": { - "Symfony\\Bridge\\Twig": "" + "Symfony\\Bridge\\Twig\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -591,20 +603,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "http://symfony.com", - "time": "2013-03-12 10:55:49" + "time": "2013-03-15 10:14:31" }, { "name": "twig/twig", - "version": "v1.9.2", + "version": "dev-master", "source": { "type": "git", - "url": "git://github.com/fabpot/Twig.git", - "reference": "v1.9.2" + "url": "https://github.com/fabpot/Twig.git", + "reference": "e8991cc2f9c84b2b5c782203904898717d46e56a" }, "dist": { "type": "zip", - "url": "https://github.com/fabpot/Twig/zipball/v1.9.2", - "reference": "v1.9.2", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/e8991cc2f9c84b2b5c782203904898717d46e56a", + "reference": "e8991cc2f9c84b2b5c782203904898717d46e56a", "shasum": "" }, "require": { @@ -613,7 +625,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -640,7 +652,7 @@ "keywords": [ "templating" ], - "time": "2012-08-25 10:32:57" + "time": "2013-03-25 07:43:31" } ], "packages-dev": [ @@ -979,12 +991,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2c67e52445416bb7c14046b432acd7eb79e4e612" + "reference": "3.7.19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2c67e52445416bb7c14046b432acd7eb79e4e612", - "reference": "2c67e52445416bb7c14046b432acd7eb79e4e612", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.19", + "reference": "3.7.19", "shasum": "" }, "require": { @@ -998,7 +1010,7 @@ "phpunit/php-text-template": ">=1.1.1", "phpunit/php-timer": ">=1.0.2,<1.1.0", "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0", - "symfony/yaml": ">=2.2.0" + "symfony/yaml": ">=2.0.0,<2.3.0" }, "require-dev": { "pear-pear/pear": "1.9.4" @@ -1045,7 +1057,7 @@ "testing", "xunit" ], - "time": "2013-03-11 07:06:05" + "time": "2013-03-25 11:45:06" }, { "name": "phpunit/phpunit-mock-objects", @@ -1098,34 +1110,39 @@ }, { "name": "symfony/browser-kit", - "version": "2.1.x-dev", + "version": "2.2.x-dev", "target-dir": "Symfony/Component/BrowserKit", "source": { "type": "git", "url": "https://github.com/symfony/BrowserKit.git", - "reference": "v2.1.8" + "reference": "d55e7ffd7f10bead48adb03b208bc67bd53926bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/v2.1.8", - "reference": "v2.1.8", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/d55e7ffd7f10bead48adb03b208bc67bd53926bb", + "reference": "d55e7ffd7f10bead48adb03b208bc67bd53926bb", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/dom-crawler": "2.1.*" + "symfony/dom-crawler": ">=2.0,<3.0" }, "require-dev": { - "symfony/css-selector": "2.1.*", - "symfony/process": "2.1.*" + "symfony/css-selector": ">=2.0,<3.0", + "symfony/process": ">=2.0,<3.0" }, "suggest": { - "symfony/process": "2.1.*" + "symfony/process": "2.2.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, "autoload": { "psr-0": { - "Symfony\\Component\\BrowserKit": "" + "Symfony\\Component\\BrowserKit\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1144,30 +1161,35 @@ ], "description": "Symfony BrowserKit Component", "homepage": "http://symfony.com", - "time": "2013-02-22 06:39:07" + "time": "2013-03-15 10:14:31" }, { "name": "symfony/css-selector", - "version": "2.1.x-dev", + "version": "2.2.x-dev", "target-dir": "Symfony/Component/CssSelector", "source": { "type": "git", "url": "https://github.com/symfony/CssSelector.git", - "reference": "v2.1.8" + "reference": "v2.2.0-RC3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.1.8", - "reference": "v2.1.8", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.2.0-RC3", + "reference": "v2.2.0-RC3", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, "autoload": { "psr-0": { - "Symfony\\Component\\CssSelector": "" + "Symfony\\Component\\CssSelector\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1186,36 +1208,41 @@ ], "description": "Symfony CssSelector Component", "homepage": "http://symfony.com", - "time": "2013-01-09 08:51:07" + "time": "2013-01-17 15:25:59" }, { "name": "symfony/dom-crawler", - "version": "2.1.x-dev", + "version": "dev-master", "target-dir": "Symfony/Component/DomCrawler", "source": { "type": "git", "url": "https://github.com/symfony/DomCrawler.git", - "reference": "227204697da76258a3f7f8d91d72568f4c55e31c" + "reference": "c9698b3b5b93d18250f627a9001c88fe5bc87908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/227204697da76258a3f7f8d91d72568f4c55e31c", - "reference": "227204697da76258a3f7f8d91d72568f4c55e31c", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/c9698b3b5b93d18250f627a9001c88fe5bc87908", + "reference": "c9698b3b5b93d18250f627a9001c88fe5bc87908", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/css-selector": "2.1.*" + "symfony/css-selector": ">=2.0,<3.0" }, "suggest": { - "symfony/css-selector": "2.1.*" + "symfony/css-selector": "2.2.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, "autoload": { "psr-0": { - "Symfony\\Component\\DomCrawler": "" + "Symfony\\Component\\DomCrawler\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1234,7 +1261,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "http://symfony.com", - "time": "2013-03-02 15:23:18" + "time": "2013-03-23 07:35:36" }, { "name": "symfony/finder", @@ -1243,12 +1270,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "69858f868c0caabe3d859c448f98d249541c0489" + "reference": "v2.1.9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/69858f868c0caabe3d859c448f98d249541c0489", - "reference": "69858f868c0caabe3d859c448f98d249541c0489", + "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.1.9", + "reference": "v2.1.9", "shasum": "" }, "require": { @@ -1280,17 +1307,17 @@ }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "2.2.x-dev", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "f198ac28048eeceae852419c076123aaee59cd1c" + "reference": "3f6d4ab3fd8226ab4ba0be9fc8a238f4338b79ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/f198ac28048eeceae852419c076123aaee59cd1c", - "reference": "f198ac28048eeceae852419c076123aaee59cd1c", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/3f6d4ab3fd8226ab4ba0be9fc8a238f4338b79ab", + "reference": "3f6d4ab3fd8226ab4ba0be9fc8a238f4338b79ab", "shasum": "" }, "require": { @@ -1299,7 +1326,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -1323,7 +1350,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2013-01-31 21:39:01" + "time": "2013-03-23 07:49:54" }, { "name": "zetacomponents/base", @@ -1460,7 +1487,7 @@ ], "minimum-stability": "dev", "stability-flags": { - "klaussilveira/gitter": 20 + "silex/silex": 20 }, "platform": [ From cb71550e7e698fb7cfa42ca6a5548834e14ada3a Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:09:05 -0300 Subject: [PATCH 02/12] Fixes #255 --- web/js/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/js/main.js b/web/js/main.js index ba9c827..7a44497 100755 --- a/web/js/main.js +++ b/web/js/main.js @@ -27,15 +27,16 @@ $(function () { function paginate() { var $pager = $('.pager'); + $pager.find('.next a').one('click', function (e) { e.preventDefault(); - $(this).css('pointer-events', 'none'); $.get(this.href, function (html) { $pager.after(html); $pager.remove(); paginate(); }); }); + $pager.find('.previous').remove(); } paginate(); From 1f103627c3a820191e77a8bb8f4189d0db9e8301 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:11:16 -0300 Subject: [PATCH 03/12] Strict standards fix --- src/GitList/Git/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index ab5840b..8bd51dc 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -27,7 +27,7 @@ class Repository extends BaseRepository /** * Get the current branch, returning a default value when HEAD is detached. */ - public function getHead() + public function getHead($default = null) { $client = $this->getClient(); From 132ba426162721aed7eab3fa2aac4686f7a64807 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:49:18 -0300 Subject: [PATCH 04/12] CS fixes --- src/GitList/Application.php | 2 +- src/GitList/Config.php | 4 +- src/GitList/Controller/BlobController.php | 12 ++-- src/GitList/Controller/CommitController.php | 22 +++--- src/GitList/Controller/MainController.php | 8 +-- src/GitList/Controller/TreeController.php | 18 ++--- src/GitList/Git/Repository.php | 21 +++--- src/GitList/Util/Repository.php | 3 +- src/GitList/Util/Routing.php | 76 ++++++++++++--------- 9 files changed, 89 insertions(+), 77 deletions(-) diff --git a/src/GitList/Application.php b/src/GitList/Application.php index bfec00a..9671dd6 100644 --- a/src/GitList/Application.php +++ b/src/GitList/Application.php @@ -48,7 +48,7 @@ class Application extends SilexApplication $this->register(new UrlGeneratorServiceProvider()); $this->register(new RoutingUtilServiceProvider()); - $this['twig'] = $this->share($this->extend('twig', function($twig, $app) { + $this['twig'] = $this->share($this->extend('twig', function ($twig, $app) { $twig->addFilter('htmlentities', new \Twig_Filter_Function('htmlentities')); $twig->addFilter('md5', new \Twig_Filter_Function('md5')); diff --git a/src/GitList/Config.php b/src/GitList/Config.php index 33d5b39..60bbf5c 100644 --- a/src/GitList/Config.php +++ b/src/GitList/Config.php @@ -6,11 +6,13 @@ class Config { protected $data; - public static function fromFile($file) { + public static function fromFile($file) + { if (!file_exists($file)) { die(sprintf('Please, create the %1$s file.', $file)); } $data = parse_ini_file($file, true); + return new static($data); } diff --git a/src/GitList/Controller/BlobController.php b/src/GitList/Controller/BlobController.php index 90f753f..a954da0 100644 --- a/src/GitList/Controller/BlobController.php +++ b/src/GitList/Controller/BlobController.php @@ -12,11 +12,11 @@ class BlobController implements ControllerProviderInterface { $route = $app['controllers_factory']; - $route->get('{repo}/blob/{commitish_path}', function($repo, $commitish_path) use ($app) { + $route->get('{repo}/blob/{commitishPath}', function ($repo, $commitishPath) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); list($branch, $file) = $app['util.routing'] - ->parseCommitishPathParam($commitish_path, $repo); + ->parseCommitishPathParam($commitishPath, $repo); list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file); @@ -43,14 +43,14 @@ class BlobController implements ControllerProviderInterface 'tags' => $repository->getTags(), )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('commitish_path', '.+') + ->assert('commitishPath', '.+') ->bind('blob'); - $route->get('{repo}/raw/{commitish_path}', function($repo, $commitish_path) use ($app) { + $route->get('{repo}/raw/{commitishPath}', function ($repo, $commitishPath) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); list($branch, $file) = $app['util.routing'] - ->parseCommitishPathParam($commitish_path, $repo); + ->parseCommitishPathParam($commitishPath, $repo); list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file); @@ -67,7 +67,7 @@ class BlobController implements ControllerProviderInterface return new Response($blob, 200, $headers); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('commitish_path', $app['util.routing']->getCommitishPathRegex()) + ->assert('commitishPath', $app['util.routing']->getCommitishPathRegex()) ->bind('blob_raw'); return $route; diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index 306b327..aaa6c85 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -12,15 +12,15 @@ class CommitController implements ControllerProviderInterface { $route = $app['controllers_factory']; - $route->get('{repo}/commits/{commitish_path}', function($repo, $commitish_path) use ($app) { + $route->get('{repo}/commits/{commitishPath}', function ($repo, $commitishPath) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - if ($commitish_path === null) { - $commitish_path = $repository->getHead(); + if ($commitishPath === null) { + $commitishPath = $repository->getHead(); } list($branch, $file) = $app['util.routing'] - ->parseCommitishPathParam($commitish_path, $repo); + ->parseCommitishPathParam($commitishPath, $repo); list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file); @@ -48,11 +48,11 @@ class CommitController implements ControllerProviderInterface 'file' => $file, )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('commitish_path', $app['util.routing']->getCommitishPathRegex()) - ->value('commitish_path', null) + ->assert('commitishPath', $app['util.routing']->getCommitishPathRegex()) + ->value('commitishPath', null) ->bind('commits'); - $route->post('{repo}/commits/{branch}/search', function(Request $request, $repo, $branch = '') use ($app) { + $route->post('{repo}/commits/{branch}/search', function (Request $request, $repo, $branch = '') use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); $query = $request->get('query'); $commits = $repository->searchCommitLog($query); @@ -77,7 +77,7 @@ class CommitController implements ControllerProviderInterface ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('searchcommits'); - $route->get('{repo}/commit/{commit}', function($repo, $commit) use ($app) { + $route->get('{repo}/commit/{commit}', function ($repo, $commit) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); $commit = $repository->getCommit($commit); $branch = $repository->getHead(); @@ -91,11 +91,11 @@ class CommitController implements ControllerProviderInterface ->assert('commit', '[a-f0-9^]+') ->bind('commit'); - $route->get('{repo}/blame/{commitish_path}', function($repo, $commitish_path) use ($app) { + $route->get('{repo}/blame/{commitishPath}', function ($repo, $commitishPath) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); list($branch, $file) = $app['util.routing'] - ->parseCommitishPathParam($commitish_path, $repo); + ->parseCommitishPathParam($commitishPath, $repo); list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file); @@ -110,7 +110,7 @@ class CommitController implements ControllerProviderInterface 'blames' => $blames, )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('commitish_path', $app['util.routing']->getCommitishPathRegex()) + ->assert('commitishPath', $app['util.routing']->getCommitishPathRegex()) ->bind('blame'); return $route; diff --git a/src/GitList/Controller/MainController.php b/src/GitList/Controller/MainController.php index 8352754..f7b5a85 100644 --- a/src/GitList/Controller/MainController.php +++ b/src/GitList/Controller/MainController.php @@ -12,7 +12,7 @@ class MainController implements ControllerProviderInterface { $route = $app['controllers_factory']; - $route->get('/', function() use ($app) { + $route->get('/', function () use ($app) { $repositories = array_map( function ($repo) use ($app) { $repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']); @@ -29,7 +29,7 @@ class MainController implements ControllerProviderInterface )); })->bind('homepage'); - $route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) { + $route->get('{repo}/stats/{branch}', function ($repo, $branch) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); if ($branch === null) { $branch = $repository->getHead(); @@ -43,14 +43,14 @@ class MainController implements ControllerProviderInterface 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), 'stats' => $stats, - 'authors' => $authors, + 'authors' => $authors, )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', $app['util.routing']->getBranchRegex()) ->value('branch', null) ->bind('stats'); - $route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) { + $route->get('{repo}/{branch}/rss/', function ($repo, $branch) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); if ($branch === null) { diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index 1ffb767..f807145 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -13,13 +13,13 @@ class TreeController implements ControllerProviderInterface { $route = $app['controllers_factory']; - $route->get('{repo}/tree/{commitish_path}/', $treeController = function($repo, $commitish_path = '') use ($app) { + $route->get('{repo}/tree/{commitishPath}/', $treeController = function ($repo, $commitishPath = '') use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - if (!$commitish_path) { - $commitish_path = $repository->getHead(); + if (!$commitishPath) { + $commitishPath = $repository->getHead(); } - list($branch, $tree) = $app['util.routing']->parseCommitishPathParam($commitish_path, $repo); + list($branch, $tree) = $app['util.routing']->parseCommitishPathParam($commitishPath, $repo); list($branch, $tree) = $app['util.repository']->extractRef($repository, $branch, $tree); $files = $repository->getTree($tree ? "$branch:\"$tree\"/" : $branch); @@ -44,10 +44,10 @@ class TreeController implements ControllerProviderInterface 'readme' => $app['util.repository']->getReadme($repo, $branch), )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('commitish_path', $app['util.routing']->getCommitishPathRegex()) + ->assert('commitishPath', $app['util.routing']->getCommitishPathRegex()) ->bind('tree'); - $route->post('{repo}/tree/{branch}/search', function(Request $request, $repo, $branch = '', $tree = '') use ($app) { + $route->post('{repo}/tree/{branch}/search', function (Request $request, $repo, $branch = '', $tree = '') use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); if (!$branch) { @@ -71,18 +71,18 @@ class TreeController implements ControllerProviderInterface ->assert('branch', '[\w-._\/]+') ->bind('search'); - $route->get('{repo}/{branch}/', function($repo, $branch) use ($app, $treeController) { + $route->get('{repo}/{branch}/', function ($repo, $branch) use ($app, $treeController) { return $treeController($repo, $branch); })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('branch'); - $route->get('{repo}/', function($repo) use ($app, $treeController) { + $route->get('{repo}/', function ($repo) use ($app, $treeController) { return $treeController($repo); })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->bind('repository'); - $route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) { + $route->get('{repo}/{format}ball/{branch}', function ($repo, $format, $branch) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); $tree = $repository->getBranchTree($branch); diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index 8bd51dc..08ba971 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -11,10 +11,10 @@ use Symfony\Component\Filesystem\Filesystem; class Repository extends BaseRepository { /** - * Return TRUE if the repo contains this commit. + * Return true if the repo contains this commit. * * @param $commitHash Hash of commit whose existence we want to check - * @return boolean Whether or not the commit exists in this repo + * @return boolean Whether or not the commit exists in this repo */ public function hasCommit($commitHash) { @@ -104,8 +104,8 @@ class Repository extends BaseRepository /** * Read diff logs and generate a collection of diffs * - * @param array $logs Array of log rows - * @return array Array of diffs + * @param array $logs Array of log rows + * @return array Array of diffs */ public function readDiffLogs(array $logs) { @@ -313,7 +313,7 @@ class Repository extends BaseRepository $data['size'] += $file[3]; } - if (($pos = strrpos($file[4], '.')) !== FALSE) { + if (($pos = strrpos($file[4], '.')) !== false) { $data['extensions'][] = substr($file[4], $pos); } } @@ -339,21 +339,22 @@ class Repository extends BaseRepository } /** - * Return TRUE if $path exists in $branch; return FALSE otherwise. + * Return true if $path exists in $branch; return false otherwise. * * @param string $commitish Commitish reference; branch, tag, SHA1, etc. - * @param string $path Path whose existence we want to verify. + * @param string $path Path whose existence we want to verify. * * GRIPE Arguably belongs in Gitter, as it's generally useful functionality. * Also, this really may not be the best way to do this. */ - public function pathExists($commitish, $path) { + public function pathExists($commitish, $path) + { $output = $this->getClient()->run($this, "ls-tree $commitish $path"); if (strlen($output) > 0) { - return TRUE; + return true; } - return FALSE; + return false; } } diff --git a/src/GitList/Util/Repository.php b/src/GitList/Util/Repository.php index 4ab0202..1782dac 100644 --- a/src/GitList/Util/Repository.php +++ b/src/GitList/Util/Repository.php @@ -189,7 +189,7 @@ class Repository * @param string $tree * @return array */ - public function extractRef($repository, $branch='', $tree='') + public function extractRef($repository, $branch = '', $tree = '') { $branch = trim($branch, '/'); $tree = trim($tree, '/'); @@ -219,5 +219,4 @@ class Repository return array($branch, $tree); } - } diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index 3f3c866..caeda25 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -1,6 +1,6 @@ app = $app; } - /* @brief Return $commitish, $path parsed from $commitish_path, based on + /* @brief Return $commitish, $path parsed from $commitishPath, based on * what's in $repo. Raise a 404 if $branchpath does not represent a * valid branch and path. * * A helper for parsing routes that use commit-ish names and paths * separated by /, since route regexes are not enough to get that right. */ - public function parseCommitishPathParam($commitish_path, $repo) { + public function parseCommitishPathParam($commitishPath, $repo) + { $app = $this->app; $repository = $app['git']->getRepository($app['git.repos'] . $repo); $commitish = null; $path = null; - $slash_pos = strpos($commitish_path, '/'); - if (strlen($commitish_path) >= 40 && - ($slash_pos === FALSE || - $slash_pos === 40)) { + $slashPosition = strpos($commitishPath, '/'); + if (strlen($commitishPath) >= 40 && + ($slashPosition === false || + $slashPosition === 40)) { // We may have a commit hash as our commitish. - $hash = substr($commitish_path, 0, 40); + $hash = substr($commitishPath, 0, 40); if ($repository->hasCommit($hash)) { $commitish = $hash; } @@ -48,56 +49,57 @@ class Routing $branches = array_merge($branches, $tags); } - $matched_branch = null; - $matched_branch_name_len = 0; + $matchedBranch = null; + $matchedBranchLength = 0; foreach ($branches as $branch) { - if (strpos($commitish_path, $branch) === 0 && - strlen($branch) > $matched_branch_name_len) { - $matched_branch = $branch; - $matched_branch_name_len = strlen($matched_branch); + if (strpos($commitishPath, $branch) === 0 && + strlen($branch) > $matchedBranchLength) { + $matchedBranch = $branch; + $matchedBranchLength = strlen($matchedBranch); } } - $commitish = $matched_branch; + $commitish = $matchedBranch; } if ($commitish === null) { - $app->abort(404, "'$branch_path' does not appear to contain a " . - "commit-ish for '$repo.'"); + $app->abort(404, "'$branch_path' does not appear to contain a commit-ish for '$repo'."); } - $commitish_len = strlen($commitish); - $path = substr($commitish_path, $commitish_len); + $commitishLength = strlen($commitish); + $path = substr($commitishPath, $commitishLength); if (strpos($path, '/') === 0) { $path = substr($path, 1); } - $commit_has_path = $repository->pathExists($commitish, $path); - if ($commit_has_path !== TRUE) { + $commitHasPath = $repository->pathExists($commitish, $path); + if ($commitHasPath !== true) { $app->abort(404, "\"$path\" does not exist in \"$commitish\"."); } return array($commitish, $path); } - public function getBranchRegex() { - static $branch_regex = null; + public function getBranchRegex() + { + static $branchRegex = null; - if ($branch_regex === null) { - $branch_regex = '[\w-._\/]+'; + if ($branchRegex === null) { + $branchRegex = '[\w-._\/]+'; } - return $branch_regex; + return $branchRegex; } - public function getCommitishPathRegex() { - static $commitish_path_regex = null; + public function getCommitishPathRegex() + { + static $commitishPathRegex = null; - if ($commitish_path_regex === null) { - $commitish_path_regex = '.+'; + if ($commitishPathRegex === null) { + $commitishPathRegex = '.+'; } - return $commitish_path_regex; + return $commitishPathRegex; } public function getRepositoryRegex() @@ -112,7 +114,14 @@ class Routing }, $this->app['git']->getRepositories($this->app['git.repos']) ); - usort($quotedPaths, function ($a, $b) { return strlen($b) - strlen($a); }); + + usort( + $quotedPaths, + function ($a, $b) { + return strlen($b) - strlen($a); + } + ); + $regex = implode('|', $quotedPaths); } @@ -122,13 +131,14 @@ class Routing /** * Strips the base path from a full repository path * - * @param string $repoPath Full path to the repository + * @param string $repoPath Full path to the repository * @return string Relative path to the repository from git.repositories */ public function getRelativePath($repoPath) { if (strpos($repoPath, $this->app['git.repos']) === 0) { $relativePath = substr($repoPath, strlen($this->app['git.repos'])); + return ltrim(strtr($relativePath, '\\', '/'), '/'); } else { throw new \InvalidArgumentException( From 90a854bf06ab82a3b6732b2a45fe64b6f7a91a9e Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:53:25 -0300 Subject: [PATCH 05/12] More CS fixes --- views/breadcrumb.twig | 2 +- views/commit.twig | 4 ++-- views/file.twig | 10 +++++----- views/menu.twig | 2 +- views/tree.twig | 12 ++++++------ web/css/style.css | 8 ++++---- web/js/main.js | 4 ++-- web/less/files.less | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/views/breadcrumb.twig b/views/breadcrumb.twig index 73fff7a..6dc3dce 100644 --- a/views/breadcrumb.twig +++ b/views/breadcrumb.twig @@ -2,7 +2,7 @@
  • {{ repo }}
  • {% for breadcrumb in breadcrumbs %} / - {% if not loop.last %}{{ breadcrumb.dir }}{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %} + {% if not loop.last %}{{ breadcrumb.dir }}{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %} {% endfor %} {% block extra %}{% endblock %} diff --git a/views/commit.twig b/views/commit.twig index 0c0c74d..f46f1cb 100644 --- a/views/commit.twig +++ b/views/commit.twig @@ -30,8 +30,8 @@ diff --git a/views/file.twig b/views/file.twig index e1cc54e..7801e6e 100644 --- a/views/file.twig +++ b/views/file.twig @@ -12,16 +12,16 @@
    {% if fileType == 'image' %} -
    {{ file }}
    +
    {{ file }}
    {% elseif fileType == 'markdown' %} -
    {{ blob }}
    +
    {{ blob }}
    {% else %}
    {{ blob|htmlentities|raw }}
    diff --git a/views/menu.twig b/views/menu.twig index b920e65..074573e 100644 --- a/views/menu.twig +++ b/views/menu.twig @@ -1,5 +1,5 @@ diff --git a/views/tree.twig b/views/tree.twig index d53c736..ae23bed 100644 --- a/views/tree.twig +++ b/views/tree.twig @@ -32,7 +32,7 @@ {% if not parent %} .. {% else %} - .. + .. {% endif %} @@ -43,9 +43,9 @@ {{ file.name }} {{ file.mode }} @@ -55,11 +55,11 @@ {% if readme is defined and readme is not empty %} -
    -
    +
    +
    {{ readme.filename }}
    -
    {{ readme.content }}
    +
    {{ readme.content }}
    {% endif %} diff --git a/web/css/style.css b/web/css/style.css index f2fe4b0..31842ae 100644 --- a/web/css/style.css +++ b/web/css/style.css @@ -274,8 +274,8 @@ table .span24{float:none;width:1884px;margin-left:0;} .commit-list li:last-child{border-bottom:0;margin-bottom:25px;} .repository{margin-bottom:18px;border:1px solid #d7d7d7;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.repository .repository-header{border-bottom:1px solid #d7d7d7;text-shadow:1px 1px 1px #ffffff;padding:8px;font-weight:700;font-size:14px;} .repository .repository-body{padding:8px;background-color:#f7f7f7;}.repository .repository-body p{margin:0;} -.readme-view{width:100%;margin-bottom:18px;border:1px solid #cacaca;}.readme-view .readme-header{padding:8px;line-height:18px;text-align:left;vertical-align:bottom;background-color:#f4f4f4;background-image:-moz-linear-gradient(top, #fafafa, #eaeaea);background-image:-ms-linear-gradient(top, #fafafa, #eaeaea);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fafafa), to(#eaeaea));background-image:-webkit-linear-gradient(top, #fafafa, #eaeaea);background-image:-o-linear-gradient(top, #fafafa, #eaeaea);background-image:linear-gradient(top, #fafafa, #eaeaea);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#eaeaea', GradientType=0);border-bottom:1px solid #d7d7d7;font-weight:bold;color:#555555;text-shadow:1px 1px 1px #ffffff;height:28px;}.readme-view .readme-header .meta{float:left;padding:4px 0;font-size:14px;} -.readme-view #readme-content{padding:30px;color:#000000;} +.md-view{width:100%;margin-bottom:18px;border:1px solid #cacaca;}.md-view .md-header{padding:8px;line-height:18px;text-align:left;vertical-align:bottom;background-color:#f4f4f4;background-image:-moz-linear-gradient(top, #fafafa, #eaeaea);background-image:-ms-linear-gradient(top, #fafafa, #eaeaea);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fafafa), to(#eaeaea));background-image:-webkit-linear-gradient(top, #fafafa, #eaeaea);background-image:-o-linear-gradient(top, #fafafa, #eaeaea);background-image:linear-gradient(top, #fafafa, #eaeaea);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#eaeaea', GradientType=0);border-bottom:1px solid #d7d7d7;font-weight:bold;color:#555555;text-shadow:1px 1px 1px #ffffff;height:28px;}.md-view .md-header .meta{float:left;padding:4px 0;font-size:14px;} +.md-view #md-content{padding:30px;color:#000000;} .rss{display:inline-block;width:16px;height:16px;*margin-right:.3em;line-height:16px;vertical-align:text-top;background-image:url("../img/feed.png");background-position:0 0;background-repeat:no-repeat;}.rss:last-child{*margin-left:0;} [class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;} .icon-white{background-image:url("../img/glyphicons-halflings-white.png");} @@ -760,13 +760,13 @@ a.label:hover,a.badge:hover{color:#ffffff;text-decoration:none;cursor:pointer;} .CodeMirror-gutter-text{color:#aaa;text-align:right;padding:.4em .2em .4em .4em;white-space:pre !important;} .CodeMirror-lines{padding:.4em;white-space:pre;cursor:text;margin-left:5px;} .CodeMirror-lines *{pointer-events:none;} -.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;margin:0;padding:0;background:transparent;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;} +.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;} .CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal;} .CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden;} .CodeMirror textarea{outline:none !important;} .CodeMirror pre.CodeMirror-cursor{z-index:10;position:absolute;visibility:hidden;border-left:1px solid black;border-right:none;width:0;} .cm-keymap-fat-cursor pre.CodeMirror-cursor{width:auto;border:0;background:transparent;background:rgba(0, 200, 0, 0.4);} -.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:dximagetransform.microsoft.gradient(enabled=false);} +.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);} .CodeMirror-focused pre.CodeMirror-cursor{visibility:visible;} div.CodeMirror-selected{background:#d9d9d9;} .CodeMirror-focused div.CodeMirror-selected{background:#d7d4f0;} diff --git a/web/js/main.js b/web/js/main.js index 7a44497..e41f089 100755 --- a/web/js/main.js +++ b/web/js/main.js @@ -20,9 +20,9 @@ $(function () { }); } - if ($('#readme-content').length) { + if ($('#md-content').length) { var converter = new Showdown.converter(); - $('#readme-content').html(converter.makeHtml($('#readme-content').text())); + $('#md-content').html(converter.makeHtml($('#md-content').text())); } function paginate() { diff --git a/web/less/files.less b/web/less/files.less index 0047a79..84fc66a 100644 --- a/web/less/files.less +++ b/web/less/files.less @@ -160,12 +160,12 @@ } } -.readme-view { +.md-view { width: 100%; margin-bottom: @baseLineHeight; border: 1px solid @treeHeaderBorder; - .readme-header { + .md-header { padding: 8px; line-height: @baseLineHeight; text-align: left; @@ -183,7 +183,7 @@ } } - #readme-content { + #md-content { padding: 30px; color: @black; } From 02eb7cb185d4df1580713150b6e4f4d9c89198c5 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Thu, 28 Mar 2013 23:57:16 -0300 Subject: [PATCH 06/12] Proper MD rendering, fixes #256 --- views/tree.twig | 2 +- web/css/style.css | 6 ++++-- web/less/files.less | 47 ++++++++++++++++++++++++--------------------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/views/tree.twig b/views/tree.twig index ae23bed..9dfa8a5 100644 --- a/views/tree.twig +++ b/views/tree.twig @@ -55,7 +55,7 @@ {% if readme is defined and readme is not empty %} -
    +
    {{ readme.filename }}
    diff --git a/web/css/style.css b/web/css/style.css index 31842ae..407424e 100644 --- a/web/css/style.css +++ b/web/css/style.css @@ -274,8 +274,10 @@ table .span24{float:none;width:1884px;margin-left:0;} .commit-list li:last-child{border-bottom:0;margin-bottom:25px;} .repository{margin-bottom:18px;border:1px solid #d7d7d7;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.repository .repository-header{border-bottom:1px solid #d7d7d7;text-shadow:1px 1px 1px #ffffff;padding:8px;font-weight:700;font-size:14px;} .repository .repository-body{padding:8px;background-color:#f7f7f7;}.repository .repository-body p{margin:0;} -.md-view{width:100%;margin-bottom:18px;border:1px solid #cacaca;}.md-view .md-header{padding:8px;line-height:18px;text-align:left;vertical-align:bottom;background-color:#f4f4f4;background-image:-moz-linear-gradient(top, #fafafa, #eaeaea);background-image:-ms-linear-gradient(top, #fafafa, #eaeaea);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fafafa), to(#eaeaea));background-image:-webkit-linear-gradient(top, #fafafa, #eaeaea);background-image:-o-linear-gradient(top, #fafafa, #eaeaea);background-image:linear-gradient(top, #fafafa, #eaeaea);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#eaeaea', GradientType=0);border-bottom:1px solid #d7d7d7;font-weight:bold;color:#555555;text-shadow:1px 1px 1px #ffffff;height:28px;}.md-view .md-header .meta{float:left;padding:4px 0;font-size:14px;} -.md-view #md-content{padding:30px;color:#000000;} +.readme-view{border:1px solid #cacaca;} +.md-view{width:100%;margin-bottom:18px;} +.md-header{padding:8px;line-height:18px;text-align:left;vertical-align:bottom;background-color:#f4f4f4;background-image:-moz-linear-gradient(top, #fafafa, #eaeaea);background-image:-ms-linear-gradient(top, #fafafa, #eaeaea);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fafafa), to(#eaeaea));background-image:-webkit-linear-gradient(top, #fafafa, #eaeaea);background-image:-o-linear-gradient(top, #fafafa, #eaeaea);background-image:linear-gradient(top, #fafafa, #eaeaea);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#eaeaea', GradientType=0);border-bottom:1px solid #d7d7d7;font-weight:bold;color:#555555;text-shadow:1px 1px 1px #ffffff;height:28px;}.md-header .meta{float:left;padding:4px 0;font-size:14px;} +#md-content{padding:30px;color:#000000;} .rss{display:inline-block;width:16px;height:16px;*margin-right:.3em;line-height:16px;vertical-align:text-top;background-image:url("../img/feed.png");background-position:0 0;background-repeat:no-repeat;}.rss:last-child{*margin-left:0;} [class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;} .icon-white{background-image:url("../img/glyphicons-halflings-white.png");} diff --git a/web/less/files.less b/web/less/files.less index 84fc66a..1ae5c16 100644 --- a/web/less/files.less +++ b/web/less/files.less @@ -160,31 +160,34 @@ } } +.readme-view { + border: 1px solid @treeHeaderBorder; +} + .md-view { width: 100%; margin-bottom: @baseLineHeight; - border: 1px solid @treeHeaderBorder; +} - .md-header { - padding: 8px; - line-height: @baseLineHeight; - text-align: left; - vertical-align: bottom; - #gradient > .vertical(@treeHeaderHighlight, @treeHeader); - border-bottom: 1px solid lighten(@treeHeaderBorder, 5%); - font-weight: bold; - color: @gray; - text-shadow: 1px 1px 1px rgba(255,255,255,1); - height:28px; - .meta { - float: left; - padding: 4px 0; - font-size: 14px; - } - } - - #md-content { - padding: 30px; - color: @black; +.md-header { + padding: 8px; + line-height: @baseLineHeight; + text-align: left; + vertical-align: bottom; + #gradient > .vertical(@treeHeaderHighlight, @treeHeader); + border-bottom: 1px solid lighten(@treeHeaderBorder, 5%); + font-weight: bold; + color: @gray; + text-shadow: 1px 1px 1px rgba(255,255,255,1); + height:28px; + .meta { + float: left; + padding: 4px 0; + font-size: 14px; } } + +#md-content { + padding: 30px; + color: @black; +} \ No newline at end of file From 99ad7b568c1d0021b5d12e9042697a9e692296db Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Fri, 29 Mar 2013 00:04:36 -0300 Subject: [PATCH 07/12] Fixing problem parsing paths with spaces, fixes #281 --- src/GitList/Git/Repository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index 08ba971..c5d4909 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -349,7 +349,7 @@ class Repository extends BaseRepository */ public function pathExists($commitish, $path) { - $output = $this->getClient()->run($this, "ls-tree $commitish $path"); + $output = $this->getClient()->run($this, "ls-tree $commitish '$path'"); if (strlen($output) > 0) { return true; From f68f2edd45c5f8c36b720cf738a4397fbb48aed4 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Fri, 29 Mar 2013 00:09:01 -0300 Subject: [PATCH 08/12] Fixes #288 --- src/GitList/Git/Repository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index c5d4909..0abc8f0 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -314,7 +314,11 @@ class Repository extends BaseRepository } if (($pos = strrpos($file[4], '.')) !== false) { - $data['extensions'][] = substr($file[4], $pos); + $extension = substr($file[4], $pos); + + if (($pos = strrpos($extension, '/')) === false) { + $data['extensions'][] = $extension; + } } } From cf9aeaf7737a3346b388c740ee374d9d80fa1613 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Fri, 29 Mar 2013 00:20:28 -0300 Subject: [PATCH 09/12] Oops. I did it again. --- tests/InterfaceTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/InterfaceTest.php b/tests/InterfaceTest.php index e4c403e..e44e0b6 100644 --- a/tests/InterfaceTest.php +++ b/tests/InterfaceTest.php @@ -148,8 +148,8 @@ class InterfaceTest extends WebTestCase $this->assertTrue($client->getResponse()->isOk()); $this->assertCount(1, $crawler->filter('.tree tr:contains("README.md")')); $this->assertCount(1, $crawler->filter('.tree tr:contains("test.php")')); - $this->assertCount(1, $crawler->filter('.readme-header:contains("README.md")')); - $this->assertEquals("## GitTest\nGitTest is a *test* repository!", $crawler->filter('#readme-content')->eq(0)->text()); + $this->assertCount(1, $crawler->filter('.md-header:contains("README.md")')); + $this->assertEquals("## GitTest\nGitTest is a *test* repository!", $crawler->filter('#md-content')->eq(0)->text()); $this->assertEquals('/GitTest/blob/master/README.md', $crawler->filter('.tree tr td')->eq(0)->filter('a')->eq(0)->attr('href')); $this->assertEquals('/GitTest/blob/master/test.php', $crawler->filter('.tree tr td')->eq(3)->filter('a')->eq(0)->attr('href')); @@ -166,7 +166,7 @@ class InterfaceTest extends WebTestCase $this->assertEquals('/foobar/tree/master/myfolder/', $crawler->filter('.tree tr td')->eq(0)->filter('a')->eq(0)->attr('href')); $this->assertEquals('/foobar/tree/master/testfolder/', $crawler->filter('.tree tr td')->eq(3)->filter('a')->eq(0)->attr('href')); $this->assertEquals('/foobar/blob/master/bar.json', $crawler->filter('.tree tr td')->eq(6)->filter('a')->eq(0)->attr('href')); - $this->assertCount(0, $crawler->filter('.readme-header')); + $this->assertCount(0, $crawler->filter('.md-header')); $this->assertEquals('master', $crawler->filter('.dropdown-menu li')->eq(1)->text()); } From 4eaebed43bfe91ccd315e331a76b01c987ca383b Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Fri, 29 Mar 2013 00:26:16 -0300 Subject: [PATCH 10/12] Proper branch name validation, fixes #272 --- src/GitList/Controller/TreeController.php | 6 +++--- src/GitList/Util/Routing.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index f807145..f14ebf2 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -68,13 +68,13 @@ class TreeController implements ControllerProviderInterface 'tags' => $repository->getTags(), )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('search'); $route->get('{repo}/{branch}/', function ($repo, $branch) use ($app, $treeController) { return $treeController($repo, $branch); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('branch'); $route->get('{repo}/', function ($repo) use ($app, $treeController) { @@ -111,7 +111,7 @@ class TreeController implements ControllerProviderInterface )); })->assert('format', '(zip|tar)') ->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('archive'); return $route; diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index caeda25..a1e33f5 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -85,7 +85,7 @@ class Routing static $branchRegex = null; if ($branchRegex === null) { - $branchRegex = '[\w-._\/]+'; + $branchRegex = '(?!/|.*([/.]\.|//|@\{|\\\\))[^\040\177 ~^:?*\[]+(? Date: Fri, 29 Mar 2013 00:35:24 -0300 Subject: [PATCH 11/12] Adding favicon, fixes #237 --- views/layout.twig | 1 + web/img/favicon.png | Bin 0 -> 884 bytes 2 files changed, 1 insertion(+) create mode 100644 web/img/favicon.png diff --git a/views/layout.twig b/views/layout.twig index 9addf44..fd066e9 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -4,6 +4,7 @@ {% block title %}Welcome!{% endblock %} + diff --git a/web/img/favicon.png b/web/img/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..8fe5ce5e36179769fad04c6e02400478888b297c GIT binary patch literal 884 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabRA=0V2lay32}Yyp$b9IJXAk;tNrlP zc;lt|*+(77`01wsA%Tof-fBO6)n9w5y$7oSiv04|fG7is0J%WDKoW?6T7c-arz(*A z=%e=AU*oH<`YTV>7oMs>EkN|$55xt^0!bhjDErM<9jNS?hYApV0ds*S0~tV<07;+% zAOe~XH1n;O+Gih)Pd;kzz0}`%sROM8D){IPauv{ocU~X^fefGmpt7g#K(DER4DQ5{Q@(cd^@87=@j1RU7i!cXA9bA0(Vw_a=j_Q+<$9Y)! zroB!)p19)K=O*67JEE65*!Y8gyz831x#bWqfB(hHm-GzRZJy+E@ruhMCo@am7q^|9 zfiS_@E5O+)kt5tWF)_s5EtX;FkyrY_NKNx}aSW-rReCW!|B!(ITY~r9>i2uU->ZIa z+vs##+-}OU1m=_fr)L#+opD`jfAiep>*eB%+tRM_&-=m4{&(H$e>MNOt!7`+6L!4t zW9~C0jtj?J1h$wk8>(5nn7T=p~p9MU=o_Me}OnyDMeFY_1n*_7T=4ieo7W9=yhu|_)Mx05uZ1mUByHoD2$oG_f14hRh*;SA(azs zOl~q=#^<@1JS{Ew-dO(h@@Kur-O9LY`jtn^9!nImFxH50HKb|DD*Gica54!WnDNfc zQ;CVmEIE&B#=Nh_N(uoA&(0<`{_Eb;$Xd7bblQH$;Qg(vX33eUrM+oY?0kQET;`~i z^(s8LYp1|bv0eWM_l=o$&CLnNL@hYd-aM{vczbuQZrx|@ss(LZ_F1*D0Hc?|)78&q Iol`;+0GV@tp#T5? literal 0 HcmV?d00001 From 919c953f832cdc9d6dd00ca35d094a9260121765 Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Fri, 29 Mar 2013 00:44:06 -0300 Subject: [PATCH 12/12] Properly parsing commit body, fixes #137 --- src/GitList/Git/Repository.php | 10 +++++++--- views/commit.twig | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index 0abc8f0..dc8eec3 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -42,12 +42,16 @@ class Repository extends BaseRepository */ public function getCommit($commitHash) { - $logs = $this->getClient()->run($this, "show --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\" $commitHash"); - $logs = explode("\n", $logs); + $logs = $this->getClient()->run($this, "show --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\" $commitHash"); + $xmlEnd = strpos($logs, '') + 7; + $commitInfo = substr($logs, 0, $xmlEnd); + $commitData = substr($logs, $xmlEnd); + $logs = explode("\n", $commitData); + array_shift($logs); // Read commit metadata $format = new PrettyFormat; - $data = $format->parse($logs[0]); + $data = $format->parse($commitInfo); $commit = new Commit; $commit->importData($data[0]); diff --git a/views/commit.twig b/views/commit.twig index f46f1cb..8cbd3ac 100644 --- a/views/commit.twig +++ b/views/commit.twig @@ -13,6 +13,9 @@

    {{ commit.message }}

    + {% if commit.body is not empty %} +

    {{ commit.body | nl2br }}

    + {% endif %} {{ commit.author.name }} authored on {{ commit.date | date('d/m/Y \\a\\t H:i:s') }}
    Showing {{ commit.changedFiles }} changed files