Git log - <file_name> works correctly on the terminal, but running g.log (filename) in git python shows an error

For SOME files, it happens that in Git Python the g.log () command gives an error, but for the same file, if I do [$ git log -] on the terminal, it works correctly. The following command works very well on the terminal:

$git log -- org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitVisitor.java

      

Here is my Python code:

import git
from git import *
import sys
repo = Repo ("/home/directory/git/eclipse.jdt.core")
assert repo.bare == False
g=repo.git
loginfo = g.log('org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitVisitor.java')

      

The following error is displayed: Traceback (last call last): File ", line 1, in File" / usr / local / lib / python 2.7 / dist-packages / GitPython-0.3.2.RC1-py2.7.egg / git / cmd.py ", line 227, in return lambda * args, ** kwargs: self._call_process (name, * args, ** kwargs) File" / usr / local / lib / python 2.7 / dist-packages / GitPython-0.3 .2.RC1-py2.7.egg / git / cmd.py ", line 456, in _call_process return self.execute (call, ** _ kwargs) File" / usr / local / lib / python 2.7 / dist-packages /GitPython-0.3.2.RC1-py2.7.egg/git/cmd.py ", line 377, in execution raise GitCommandError (command, status, stderr_value) git.exc.GitCommandError: 'git log org.eclipse.jdt .core / model / org / eclipse / jdt / internal / core / CompilationUnitVisitor.java 'returned exit status 128: fatal: ambiguous argument' org.eclipse.jdt.core / model / org / eclipse / jdt / internal / core / CompilationUnitVisitor.java ': Unknown version or path not in working tree. Use '-' to separate paths from revisions, for example: 'git [...] - [...]'

Can anyone suggest how to fix it?

+3


source share


1 answer


--

lost when called g.log(...)

. The correct way to do this is as follows.



g.log('--', "org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitVisitor.java")

      

+1


source







All Articles