Reputation: 12837
using GitPython and trying to print logs:
print(self._git.log('{}..{} --pretty=tformat:%h:%s:%cn'.format(self.good, self.bad).split()))
where:
self._repo = git.Repo(path=repo, search_parent_directories=True)
self._git = git.Git(self._repo.working_tree_dir)
and getting this error
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git log 7900edaa7973536bd53bea35404772b46735c46a..83bd42668003bb6075e44fd44ec21a39dd90096f --pretty=tformat:%h:%s:%cn
stderr: 'fatal: Invalid revision range 7900edaa7973536bd53bea35404772b46735c46a..83bd42668003bb6075e44fd44ec21a39dd90096f'
but when running the command from the error (i.e. git log 7900edaa7973536bd53bea35404772b46735c46a..83bd42668003bb6075e44fd44ec21a39dd90096f --pretty=tformat:%h:%s:%cn
) from bash, I get a normal result.
It did work, when I replaced the commits with count (print(self._git.log('-4 --pretty=tformat:%h:%s:%cn'.split()))
)
Upvotes: 3
Views: 591
Reputation: 10821
This is working for me in a test project with python 2.7.16 and GitPython 2.1.14.
Base on the error message (invalid revision range) I think your python code is using a different repository than where you are running the git
command from the shell.
Upvotes: 2