Giter Site home page Giter Site logo

phpgit's People

Contributors

kzykhys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpgit's Issues

The process has been signaled with signal "5" on Git Clone

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.

PHP Warning: escapeshellarg() expects parameter 1 to be string, given an Array

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));

Depreciated interface in symfony 2.6

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,

PHP Catchable fatal error in vendor/kzykhys/git/src/PHPGit/Command/LogCommand.php

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));

BranchCommand assumes repo is in branch

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.

Branch command doesn't fetch all branches

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?

SSH Keys

Support for SSH key? I don't know if it is just Windows but it handles it really poorly.

Impossible to get the correct branch name

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 ๐Ÿ‘

Branch command assumes all short hashes are 7 characters

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?

Log doesn't maintain line feed in messages

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

License

Please decide/create a LICENSE document.

New release

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.