-
|
For some reason I cannot get output from In [1]: import git
In [2]: git.__version__
Out[2]: '3.1.27'
In [3]: g = git.Git()
In [4]: g.status()
Out[4]: 'On branch master\nYour branch is up to date with \'origin/master\'.\n\nChanges not staged for commit:\n (use "git add <file>..." to update what will be committed)\n (use "git restore <file>..." to discard changes in working directory)\n\tmodified: src/sphinxcontrib/scm/__init__.py\n\tmodified: src/sphinxcontrib/scm/directives.py\n\tmodified: src/sphinxcontrib/scm/roles.py\n\tmodified: src/sphinxcontrib/scm/util.py\n\nUntracked files:\n (use "git add <file>..." to include in what will be committed)\n\tpublish.ps1\n\nno changes added to commit (use "git add" and/or "git commit -a")'
In [5]: g.shortlog()
Out[5]: ''
PS scm> git shortlog
Christian Knittl-Frank (32):
Initial commit
...Any idea where this problem could originate from? Any more info I can provide to track down the issue? Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
That looks a little strange indeed. The docs about debugging git-python command invocations might be helpful to get some more information on what's happening. You could also try it with a plain |
Beta Was this translation helpful? Give feedback.
-
|
I found the same issue with python 3.10 and gitpython 3.1.32. Using Fix:Use: g.shortlog("HEAD")instead of g.shortlog()Explanation:From
Since GitPython uses To reproduce the wrong behaviour with subprocess: from subprocess import Popen, DEVNULL, PIPE
command = ['git', 'shortlog']
proc = Popen(command, stdin=DEVNULL, stderr=PIPE, stdout=PIPE)
print(proc.communicate()) |
Beta Was this translation helpful? Give feedback.
That looks a little strange indeed.
The docs about debugging git-python command invocations might be helpful to get some more information on what's happening.
git.shortlog()does indeed only rungit shortlog, but with redirections. Maybe those affect it in some way.You could also try it with a plain
Popen(…)call and see if the issue is similar.