modess / git-pretty-stats

Self hosted graphs for Git repositories in PHP
Other
142 stars 24 forks source link

Exception 'ErrorException' with message 'Undefined index: contributors' #32

Open tetraf opened 9 years ago

tetraf commented 9 years ago

With the last version of master branch (e0a6048e0c4e2b6902d3de3599457f8cd340f945) I have this error:

[2015-05-04 14:45:17] local.ERROR: exception 'ErrorException' with message 'Undefined index: contributors' in /srv/http/git-pretty-stats/app/GitPrettyStats/StatisticsFormatter.php:42
Stack trace:
#0 /srv/http/git-pretty-stats/app/GitPrettyStats/StatisticsFormatter.php(42): Illuminate\Exception\Handler->handleError(8, 'Undefined index...', '/srv/http/git-p...', 42, Array)
#1 /srv/http/git-pretty-stats/app/GitPrettyStats/StatisticsFormatter.php(52): GitPrettyStats\StatisticsFormatter->statistics('contributors')
#2 /srv/http/git-pretty-stats/app/GitPrettyStats/Repository.php(71): GitPrettyStats\StatisticsFormatter->contributors()
#3 /srv/http/git-pretty-stats/app/controllers/RepositoryController.php(49): GitPrettyStats\Repository->statistics()
#4 [internal function]: RepositoryController->show('test-project')
#5 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#6 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('show', Array)
#7 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(RepositoryController), Object(Illuminate\Routing\Route), 'show')
#8 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/Router.php(934): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'RepositoryContr...', 'show')
#9 [internal function]: Illuminate\Routing\{closure}('test-project')
#10 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/Route.php(104): call_user_func_array(Object(Closure), Array)
#11 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1000): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#12 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Routing/Router.php(968): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#13 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(738): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#14 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(708): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#15 /srv/http/git-pretty-stats/vendor/barryvdh/laravel-cors/src/Barryvdh/Cors/CorsMiddleware.php(33): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#16 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Http/FrameGuard.php(38): Barryvdh\Cors\CorsMiddleware->handle(Object(Illuminate\Http\Request), 1, true)
#17 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Http\FrameGuard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#19 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#20 /srv/http/git-pretty-stats/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#21 /srv/http/git-pretty-stats/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(606): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#22 /srv/http/git-pretty-stats/public/index.php(49): Illuminate\Foundation\Application->run()
#23 {main} [] []

Here the line to blame: https://github.com/modess/git-pretty-stats/commit/2f88832a6f197b5597735fb5efc93e7d3d700fc9#diff-c2254f714dda6b74520408460486cb20R43

modess commented 9 years ago

Does the repository contain any commits? I tested to create a new repository with git init but got another error than you. When I did a first initial commit it worked though. I also tested making a new branch after the initial commit and checked out the branch, also successful.

Anything else you could tell me that could help me debug this?

tetraf commented 9 years ago

I don't remember if it was a git clone or a symlink of an existing repository (with 100-200 commits). I can't access to this test environment these days.

ivanelson commented 9 years ago

I am also with this problem.

bcalik commented 9 years ago

I was at commit dfba227 from Jun 2014. Then I updated to the latest commit with "git pull". Now I get the same error when I select a repository.

My repo has 1423 commits. It was working well before updating to the latest commit.

Here is the full log:

[2015-06-25 16:24:21] local.ERROR: exception 'ErrorException' with message 'Undefined index: contributors' in /var/www/devstats.macellan.net/app/GitPrettyStats/StatisticsFormatter.php:43
Stack trace:
#0 /var/www/devstats.macellan.net/app/GitPrettyStats/StatisticsFormatter.php(43): Illuminate\Exception\Handler->handleError(8, 'Undefined index...', '/var/www/devsta...', 43, Array)
#1 /var/www/devstats.macellan.net/app/GitPrettyStats/StatisticsFormatter.php(53): GitPrettyStats\StatisticsFormatter->statistics('contributors')
#2 /var/www/devstats.macellan.net/app/GitPrettyStats/Repository.php(71): GitPrettyStats\StatisticsFormatter->contributors()
#3 /var/www/devstats.macellan.net/app/controllers/RepositoryController.php(49): GitPrettyStats\Repository->statistics()
#4 [internal function]: RepositoryController->show('demo')
#5 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#6 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('show', Array)
#7 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(RepositoryController), Object(Illuminate\Routing\Route), 'show')
#8 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(934): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'RepositoryContr...', 'show')
#9 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}('demo')
#10 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/Route.php(104): call_user_func_array(Object(Closure), Array)
#11 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1000): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#12 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Routing/Router.php(968): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#13 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(738): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#14 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(708): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#15 /var/www/devstats.macellan.net/vendor/barryvdh/laravel-cors/src/Barryvdh/Cors/CorsMiddleware.php(33): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#16 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Http/FrameGuard.php(38): Barryvdh\Cors\CorsMiddleware->handle(Object(Illuminate\Http\Request), 1, true)
#17 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Http\FrameGuard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#19 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#20 /var/www/devstats.macellan.net/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#21 /var/www/devstats.macellan.net/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(606): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#22 /var/www/devstats.macellan.net/public/index.php(49): Illuminate\Foundation\Application->run()
#23 {main} [] []
modess commented 9 years ago

Does anybody have a repository I could test this on? Can't reproduce this unfortunately.

clemlatz commented 9 years ago

I'm having the same problem with any of my repos, including the git-pretty-stats repo itself.

`'repositoriesPath' => [
        '.'
      ],`

The repos are showing on the list but when I click on one of them, I get a 500 error on the Ajax call:

{"error":{"type":"ErrorException","message":"Undefined index: contributors","file":"\/Users\/clement\/dev\/git-pretty-stats\/app\/GitPrettyStats\/StatisticsFormatter.php","line":43}}`

I'm using the PHP 5.6.10 built-in server (-S) on Mac OS 10.10.5, php executable came from MAMP. Tell me if I can give any other relevant info.

mrunyon commented 9 years ago

I'm having exactly the same issue. I have removed repos with non-public code and replaced with an old repo with personal stuff, and the problem persists. I cannot get a simple repository to show stats, all produce the same error message.

Git Pretty Stats - Home: http://stats.git.ibsinternet.com

Sample AJAX call producing the 500 error shown above: http://stats.git.ibsinternet.com/repository/registry.git

Debian Wheezy 3.2.0-04-amd64 Apache 2.2.22 PHP 5.4.39-0

I should note that all repos that I've attempted this with are bare repos, without a working directory.

germanf commented 8 years ago

Hi Guys! I was trying the app, and the error is in the cache loading My fast workaround was disabled the cache comment this

app/GitPrettyStats/RepositoryFactory.php

// Try cache 
//        $cached = Cache::get($cacheKey);
//        if ($cached !== null) {
//            return $cached;
//        }
modess commented 8 years ago

Thanks! Great that I have a point of entry for debugging :)