Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error if there is/are git sub-repository #165

Open
aBanhidy opened this issue Feb 25, 2020 · 0 comments
Open

Parsing error if there is/are git sub-repository #165

aBanhidy opened this issue Feb 25, 2020 · 0 comments

Comments

@aBanhidy
Copy link

aBanhidy commented Feb 25, 2020

Dear Gentlemens!

I start to use your products and I think it is briliant! I am working on a project where there are 2 sub-repositories in the git repository.
If I start to use the $repository->getDiff() command it throws an excpetion because of sub-repositry change.

Only what I've chenged in your source code and it looks like work:
Diff parser:
Base:

            // 4. File informations
            $isBinary = false;
            if ($this->expects('index ')) {
                $oldIndex = $this->consumeShortHash();
                $this->consume('..');
                $newIndex = $this->consumeShortHash();
                if ($this->expects(' ')) {
                    $vars = $this->consumeRegexp('/\d{6}/');
                    $newMode = $oldMode = $vars[0];
                }
                $this->consumeNewLine();
            
                if ($this->expects('--- ')) {
                 	$oldName = $this->consumeTo("\n");
                        $this->consumeNewLine();
                        $this->consume('+++ ');
                        $newName = $this->consumeTo("\n");
                        $this->consumeNewLine();
                } elseif ($this->expects('Binary files ')) {
                        $vars = $this->consumeRegexp('/(.*) and (.*) differ\n/');
                        $isBinary = true;
                        $oldName = $vars[1];
                        $newName = $vars[2];
	         }
         }

Modified:

            // 4. File informations
            $isBinary = false;
            if ($this->expects('index ')) {
                $oldIndex = $this->consumeShortHash();
                $this->consume('..');
                $newIndex = $this->consumeShortHash();
                if ($this->expects(' ')) {
                    $vars = $this->consumeRegexp('/\d{6}/');
                    $newMode = $oldMode = $vars[0];
                }
                $this->consumeNewLine();
            }
            
            if ($this->expects('--- ')) {
            	$oldName = $this->consumeTo("\n");
                $this->consumeNewLine();
                $this->consume('+++ ');
                $newName = $this->consumeTo("\n");
                $this->consumeNewLine();
            } elseif ($this->expects('Binary files ')) {
                $vars = $this->consumeRegexp('/(.*) and (.*) differ\n/');
                $isBinary = true;
                $oldName = $vars[1];
                $newName = $vars[2];
	   }

...so I just move if ($this->expects('--- ')) { part out from condition: if ($this->expects('index ')) {

I am using version : ^1.2

Thanks

@aBanhidy aBanhidy changed the title Parsing error if there is/are gut sub-repository Parsing error if there is/are git sub-repository Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant