kzykhys / phpgit Goto Github PK
View Code? Open in Web Editor NEWA Git wrapper for PHP5.3+
A Git wrapper for PHP5.3+
Support for SSH key? I don't know if it is just Windows but it handles it really poorly.
I received this warning:
PHP Warning: escapeshellarg() expects parameter 1 to be string, array given in /Users/David/Documents/Development/my-project/php/vendor/symfony/process/ProcessUtils.php on line 74
when using the following:
$git = new PHPGit\Git();
$git->setRepository('./');
$statusArr = $git->log(array('limit' => 1));
Does this wrapper works with submodules?
For example:
git submodule add https://[email protected]/user/repo.git
Hi,
I'm getting an error about a depreciated interface in symfony 2.6 when cloning a repository:
The "Symfony\Component\OptionsResolver\OptionsResolverInterface" interface was deprecated in version 2.6 and will be removed in 3.0. Use "Symfony\Component\OptionsResolver\OptionsResolver" instead.
Thanks,
Hi,
The above error occurs whenever I try to execute a Git clone with this library. Here is my code:
$git = new PHPGit\Git();
$git->clone($repository_https_url, $base_dir . $repository_dir);
I have googled this issue and found some similar issues with Composer and Symfony, which suggested I add this line:
putenv("DYLD_LIBRARY_PATH");
But this has not solved my issue. As it appears, the remote repository is being cloned successfully. The folder is created successfully.
Please decide/create a LICENSE document.
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: Missing argument 2 for Symfony\Component\OptionsResolver\OptionsResolver::setAllowedValues(), called in /home/2revlect2/vendor/kzykhys/git/src/PHPGit/Command/CommitCommand.php on line 84 and defined
In newest version I get this kind of error:
PHP Catchable fatal error: Argument 1 passed to PHPGit\Command\LogCommand::setDefaultOptions() must be an instance of Symfony\Component\OptionsResolver\OptionsResolverInterface, instance of Symfony\Component\OptionsResolver\OptionsResolver given, called in /path/vendor/kzykhys/git/src/PHPGit/Command.php on line 40 and defined in /path/vendor/kzykhys/git/src/PHPGit/Command/LogCommand.php on line 97
Changing:
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'limit' => 10,
'skip' => 0
));
}
to this:
public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'limit' => 10,
'skip' => 0
));
}
fix problem.
Problem occured while:
$this->_git->log('1.2.1..1.2.3', '', array('limit' => 1000));
Hi.
Thanks for this nice library.
I have one issue/question.
When using log:
$log = $git->log();
$log gathers messages without any line feed. Any reason why or way I can get them back?
Thanks
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'git' 'clone' '--quiet' 'https://**********.git' '../../*****/'" exceeded the timeout of
60 seconds.
The ProcessBuilder created by Git::getProcessBuilder() has no timeout set so the default timeout of 60s is used.
There is no way to change the behavior of the mentioned method from outside world.
The regular expression for parsing lines of output from the git branch command assumes that all short hashes will be exactly 7 characters, but this is not always the case.
The specific line is at src/PHPGit/Command/BranchCommand.php:67:
preg_match('/(?<current>\*| ) (?<name>[^\s]+) +((?:->) (?<alias>[^\s]+)|(?<hash>[0-9a-z]{7}) (?<title>.*))/', $line, $matches);
Suggest changing the hash capturing group to (?<hash>[0-9a-z]{7,40})
to handle all possible cases.
Additionally, the result of preg_match
should probably be checked to see if it succeeded, and either continue the loop or throw an exception?
If you're not in a branch and try to get the current branch, a notice error is raised "Undefined index: current" in BranchCommand.php around line 69.
This is a problem in unit (integration) testing.
Here I have a strange situation where the branch command seems to stumble parsing all branches correctly.
Here's a plain git branch -a
result:
$repo = '/path/to/repo';
var_dump( `cd $repo && git branch -a` );
/**
string(1268) " 1.5
2.0
2.1
2.2
2.3
2.5
2.6
2.7
2.8
2.9
3.0
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4.0
4.1
4.2
4.3
4.4
composer
* master
remotes/mirror/1.5
remotes/mirror/2.0
remotes/mirror/2.1
remotes/mirror/2.2
remotes/mirror/2.3
remotes/mirror/2.5
remotes/mirror/2.6
remotes/mirror/2.7
remotes/mirror/2.8
remotes/mirror/2.9
remotes/mirror/3.0
remotes/mirror/3.1
remotes/mirror/3.2
remotes/mirror/3.3
remotes/mirror/3.4
remotes/mirror/3.5
remotes/mirror/3.6
remotes/mirror/3.7
remotes/mirror/3.8
remotes/mirror/3.9
remotes/mirror/4.0
remotes/mirror/4.1
remotes/mirror/4.2
remotes/mirror/4.3
remotes/mirror/4.4
remotes/mirror/master
remotes/origin/1.5
remotes/origin/2.0
remotes/origin/2.1
remotes/origin/2.2
remotes/origin/2.3
remotes/origin/2.5
remotes/origin/2.6
remotes/origin/2.7
remotes/origin/2.8
remotes/origin/2.9
remotes/origin/3.0
remotes/origin/3.1
remotes/origin/3.2
remotes/origin/3.3
remotes/origin/3.4
remotes/origin/3.5
remotes/origin/3.6
remotes/origin/3.7
remotes/origin/3.8
remotes/origin/3.9
remotes/origin/4.0
remotes/origin/4.1
remotes/origin/4.2
remotes/origin/4.3
remotes/origin/4.4
remotes/origin/master
"
*/
Now this is what PHPGit returns:
$repo = '/path/to/repo';
$git->setRepository( $repo );
$branches = $git->branch( [ 'all' => TRUE ] );
var_dump( array_keys( $branches ) );
/**
array(78) {
[0]=>
string(3) "1.5"
[1]=>
string(3) "2.0"
[2]=>
string(3) "2.1"
[3]=>
string(3) "2.2"
[4]=>
string(3) "2.3"
[5]=>
string(3) "2.5"
[6]=>
string(3) "2.6"
[7]=>
string(3) "2.7"
[8]=>
string(3) "2.8"
[9]=>
string(3) "2.9"
[10]=>
string(3) "3.0"
[11]=>
string(3) "3.1"
[12]=>
string(3) "3.2"
[13]=>
string(3) "3.3"
[14]=>
string(3) "3.4"
[15]=>
string(3) "3.5"
[16]=>
string(3) "3.6"
[17]=>
string(3) "3.7"
[18]=>
string(3) "3.8"
[19]=>
string(3) "3.9"
[20]=>
string(3) "4.0"
[21]=>
string(3) "4.1"
[22]=>
string(3) "4.2"
[23]=>
string(3) "4.3"
[24]=>
string(3) "4.4"
[25]=>
string(8) "composer"
[26]=>
string(0) ""
[27]=>
string(18) "remotes/mirror/1.5"
[28]=>
string(18) "remotes/mirror/2.0"
[29]=>
string(18) "remotes/mirror/2.1"
[30]=>
string(18) "remotes/mirror/2.2"
[31]=>
string(18) "remotes/mirror/2.3"
[32]=>
string(18) "remotes/mirror/2.5"
[33]=>
string(18) "remotes/mirror/2.6"
[34]=>
string(18) "remotes/mirror/2.7"
[35]=>
string(18) "remotes/mirror/2.8"
[36]=>
string(18) "remotes/mirror/2.9"
[37]=>
string(18) "remotes/mirror/3.0"
[38]=>
string(18) "remotes/mirror/3.1"
[39]=>
string(18) "remotes/mirror/3.2"
[40]=>
string(18) "remotes/mirror/3.3"
[41]=>
string(18) "remotes/mirror/3.4"
[42]=>
string(18) "remotes/mirror/3.5"
[43]=>
string(18) "remotes/mirror/3.6"
[44]=>
string(18) "remotes/mirror/3.7"
[45]=>
string(18) "remotes/mirror/3.8"
[46]=>
string(18) "remotes/mirror/3.9"
[47]=>
string(18) "remotes/mirror/4.0"
[48]=>
string(18) "remotes/mirror/4.1"
[49]=>
string(18) "remotes/mirror/4.2"
[50]=>
string(18) "remotes/mirror/4.3"
[51]=>
string(18) "remotes/mirror/4.4"
[52]=>
string(18) "remotes/origin/1.5"
[53]=>
string(18) "remotes/origin/2.0"
[54]=>
string(18) "remotes/origin/2.1"
[55]=>
string(18) "remotes/origin/2.2"
[56]=>
string(18) "remotes/origin/2.3"
[57]=>
string(18) "remotes/origin/2.5"
[58]=>
string(18) "remotes/origin/2.6"
[59]=>
string(18) "remotes/origin/2.7"
[60]=>
string(18) "remotes/origin/2.8"
[61]=>
string(18) "remotes/origin/2.9"
[62]=>
string(18) "remotes/origin/3.0"
[63]=>
string(18) "remotes/origin/3.1"
[64]=>
string(18) "remotes/origin/3.2"
[65]=>
string(18) "remotes/origin/3.3"
[66]=>
string(18) "remotes/origin/3.4"
[67]=>
string(18) "remotes/origin/3.5"
[68]=>
string(18) "remotes/origin/3.6"
[69]=>
string(18) "remotes/origin/3.7"
[70]=>
string(18) "remotes/origin/3.8"
[71]=>
string(18) "remotes/origin/3.9"
[72]=>
string(18) "remotes/origin/4.0"
[73]=>
string(18) "remotes/origin/4.1"
[74]=>
string(18) "remotes/origin/4.2"
[75]=>
string(18) "remotes/origin/4.3"
[76]=>
string(18) "remotes/origin/4.4"
[77]=>
string(21) "remotes/origin/master"
}
*/
I used array_keys()
to keep the output short. You can see, it seems to loose master
and ignores completely remotes/mirror/master
.
Any idea what could be the reason on this?
Since the last release 10 commits have been made. Would it be ok to make a new release for these changes? I'm using one of them but I dislike using dev-master in my requirements.
When a branch track a remote branch the branch name is incorrect.
Example : ## master...origin/master [ahead 5]
Result : 5]
Expected : master
I think the issue is in the regex here
BTW congrats, you did an amazing work with this library ๐
Currently the archive command does not except --remote
as an option.
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.