klaussilveira / gitter Goto Github PK
View Code? Open in Web Editor NEWGitter allows you to interact in an object oriented manner with Git repositories.
License: BSD 3-Clause "New" or "Revised" License
Gitter allows you to interact in an object oriented manner with Git repositories.
License: BSD 3-Clause "New" or "Revised" License
Feature request. Some info about this is stored on the individual DiffLine objects (DiffLine::$numOld?). But for easy access would I like a method to retrieve this on the Diff object.
Faced in mglaman/drupalorg-cli#170 when newer version of Symfony changed API
basic fix is
- $process = new Process(...);
+ $process = Process::fromShellCommandline(...);
At the moment the FULL commit history is loaded into memory when you do getCommits()
-- this can consume a lot of memory on large repositories. It would be cool to be able to pass a time filter to the commit function like getCommits('1 week ago');
git log --since="1 week ago"
Or even better, allow options to be passed:
getCommits(['since' => '1 week ago', 'n' => 20]);
PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /usr/local/share/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Model/Object.php on line 14
Why creating yet another git lib for PHP ?
https://github.com/gitonomy/gitlib
Merge commit have 2 parents.
how to get the last commit?
Hi,
I would like to add getLatestTag method into the Repository class.
Or, getTag method return with Tag class from Repository class, and getAll; getLast methods will be in Tag class.
What do you think about this?
this is the code
$client->run($repo, 'commit --author="'.$author->username.' <'.$author->email.'>" -m "'.htmlspecialchars($model->message).'"');
The guichan repo (https://code.google.com/p/guichan/) has some log entries which are utf-8 encoded, some which are not. All of these get appended together and the XML encoder has not way to parse the string.
Fixed by adding a single line to getPrettyFormat in Repository.php:
public function getPrettyFormat($command)
{
$output = $this->getClient()->run($this, $command);
$format = new PrettyFormat;
+ // Remove invalid UTF-8 sequences (which would trip the XML parser)
+ $output = mb_convert_encoding($output, 'UTF-8', 'UTF-8');
return $format->parse($output);
}
In the gitter client on line 134 (https://github.com/klaussilveira/gitter/blob/master/lib/Gitter/Client.php#L134) there is a command line option which isn't available on older git clients.
In my case this was with git 1.7.1, on CentOS release 6.3 (Final). Running git -c on my system gives the same option as the GitList application is given, with the cause located in Gitter, see debug below
RuntimeException: Unknown option: -c
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
This command is not available, at least not on my system and not on the internet.
Perhaps a variation of 'git ls-tree' was meant here? If so, please check the parameters needed here for the call, because that doesn't work either. the '-l' parameter is not defined, and the call needs a branch name.
I've got a docker build based on alpine 3.7 + php-fpm 7.1 + nginx:
https://github.com/cmanley/gitlist-docker
I'd like to use PHP 7.2, but the 1.01 build on gitlist.org does not support PHP 7.2 yet (due to class named Object).
Thanks
there is 1 year old bugfix ready for merge - #52
Add the commit body to Commit class.
The body can be multiline.
่ฏดๆ.md
commit it
$commit = $repo->getCommit($hash);
<?php foreach ($commit->getDiffs() as $key => $diff): ?>
<?php var_dump($diff->getFile());?> //NULL
<?php endforeach ?>
A normal commit has the following line in a diff (if filename is "master")
diff --git a/master b/master
On a merge, this line might be:
diff --cc master
The regex then fails on lib/Gitter/Repository.php line 436
if (preg_match('/^diff --[\S]+ a\/?(.+) b\/?/', $log, $name)) {
$diff->setFile($name[1]);
}
What is it refactoring
branch?
Is there still some work on it? Or could it be deleted?
proposed fix: #52
When trying to view the commits of particular repository in GitList I get this exception:
Exception: DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead
and this trace:
in /var/www/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Util/DateTime.php line 39
at DateTime->construct('@1350996256', null) in /var/www/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Util/DateTime.php line 39
at DateTime->construct('@1350996256') in /var/www/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Model/Commit/Commit.php line 42
at Commit->importData(array('hash' => '513560c083067d258ee92c0caf7da3aa897d38d4', 'short_hash' => '513560c', 'tree' => '587411bbe4a6fd2dbac5e6a3618968f859382eed', 'parent' => 'd455b09ae033b93b1d6da2adfa537ba8fe53f1c8', 'author' => 'Jasper Lievisse Adriaanse', 'author_email' => 'jasper@localhost', 'date' => '1350996256', 'commiter' => 'Jasper Lievisse Adriaanse', 'commiter_email' => 'jasper@localhost', 'commiter_date' => '1350996256', 'message' => 'moved to branches/$release/sites/')) in /var/www/gitlist/src/GitList/Git/Repository.php line 31
at Repository->getPaginatedCommits('master', '0') in /var/www/gitlist/src/GitList/Controller/CommitController.php line 21
at GitList\Controller{closure}('scripts', 'master', '')
at call_user_func_array(object(Closure), array('scripts', 'master', '')) in /var/www/gitlist/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 129
at HttpKernel->handleRaw(object(Request), '1') in /var/www/gitlist/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
at HttpKernel->handle(object(Request), '1', true) in /var/www/gitlist/vendor/silex/silex/src/Silex/Application.php line 509
at Application->handle(object(Request)) in /var/www/gitlist/vendor/silex/silex/src/Silex/Application.php line 484
at Application->run() in /var/www/gitlist/index.php line 10
my php.ini has:
;date.timezone =
This happens on OpenBSD 5.2 with 5.3.17 with the Suhosin patch applied.
Adding this to Gitter/Util/DateTime.php on line 39 fixes the issue for me:
date_default_timezone_set('UTC');
Since the license itself shows:
Copyright (c) 2012-2015, Klaus Silveira and contributors
This is confirmed, the continuing is here:
https://github.com/patrikx3/gitter
Hello,
apparently php 7.2.2 brings this type of errors to the server:
PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /usr/share/webapps/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Model/Object.php
I googled a bit and found this to be not unique to gitlist, for instance:
unclead/yii2-multiple-input@7b79bfa
I tried to follow the solution as featured on the git commit above on the following files:
gitter/lib/Gitter/Model/Commit/Commit.php
gitter/lib/Gitter/Model/Tree.php
gitter/lib/Gitter/Model/Blob.php
and renamed
gitter/lib/Gitter/Model/Object.php -> gitter/lib/Gitter/Model/BaseObject.php
and got it to half work. I was able to navigate the git commits and history but I was not able to retrieve files directly.
Thanks for this software, this were just my two cents on the issue.
The getOld() and getNew() methods, includes the +++ and --- before the file names.
The git repos contains files named like index(0).html. The file names display correctly when the enclosing directory is selected but the contents are not displayed neither pretty print nor raw.
gitter_issue_web_source.tar.gz
After pressing the 'patch log' button
Note the proliferation of the '\' character
I wondered if the problem was caused by the %5c%280%5c%29 string not being translated into ascii characters but I tried using urldecode() in Blob.php to no avail.
On line 393 of /lib/Gitter/Repository.php the follwing terminal command is generated:
git show --ignore-blank-lines -w -b --pretty=format:"%H<short_hash>%h</short_hash>%T%P%an<author_email>%ae</author_email>%at%cn<commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date>" 452942534f9edfa02cc914964d3fecce451c6d81
It should assign a string of xml tags to the $logs variable.
Lines 397 to 401 appear to turn these xml tags into an array. And then that array is given to $commit->importData on line 407.
I am getting a fatal error:
Catchable fatal error: Argument 1 passed to Gitter\Model\Commit\Commit::importData() must be of the type array, null given, called in lib/Gitter/Repository.php on line 407
If I take the terminal command responsible for generating the $logs variable and run it in my terminal I do not get any xml tags in the output.
This in turn causes the rest of the code to fail.
Hi there,
I'm using Gitter though composer on a Laravel app. Everything seemed to go fine in the installation except this error I'm getting:
Undefined index: ini.file
The error points to this line:
$this->inifile = $options['ini.file'];
What should I do to overcome this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.