- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 934
GitPython 3.0.3 - 3.1.0 unable to get diffs from bare repo #993
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
Comments
Thanks for posting, and for providing the means to reproduce the issue. Which OS are you using, and which Git version? Sometimes this matters a lot. |
I tested it on python:3.7.3-stretch docker, 3.1.0 version gitpython, git version is 2.11.0
I think it is our repo has wrong HEAD, so error is correct and announce it.
3.0.3 is working 3.0.4~ are raise error on this b303cb0 |
Sorry for late reply. For me it occurs on macOS Mojave 10.14.6, Python 3.7.6 with git version 2.25.0 |
Thanks for the update. The question I can't really answer to myself is if the behaviour of GitPython 3.0.2 is desirable, as it seems to ignore the dangling ref or doesn't run into that issue for other reasons. What does git itself do? Since the issue seems to come from the diff implementation, it must be something that changed there in more recent versions of GitPython. Maybe that can be tracked down to lead to an improved quality of life, especially under the assumption that git itself won't fail like that. |
Having just seen issue 999, it looks like we got the answer: Git itself will fail to diff if there is a dangling HEAD reference. Thus the behaviour of GitPython can be considered adequate, assuming git always knows what's best :D. Thus I recommend closing this issue, what do you think, @romuaa ? |
Indeed it seems to be the case that the git diff fails. Unfortunately I don't know enough about git to understand why it does so. Also I quite don't understand why GitPython 3.0.2 still works. $ git diff-tree c9ec46881167c97ea0112754d10a913a39e58f15 83f1b4bba8f2b861965214ea95c0ea773c4b1872 -r --abbrev=40 --full-index -M --raw --no-color |
that commit is about involving submodule changes, submodule logic is need to access to 'HEAD' which is default ref. Your git 'HEAD' can not link any refs in repo, so I recommend checking your 'HEAD' or using version 3.0.4. |
If it helps at all that commit hash is actually from https://github.com/romuaa/test_stuff you should be able to access that. There's only some test stuff with couple of 'feature' branches. No sub modules in use. GitPython 3.0.2 works fine and anything above fails. |
got the same issue for repo with bunch of submodules
GitPython>=3.0.6
git diff-tree output example
|
GitPython 3.0.2 works properly.
GitPython 3.0.3 is unable to read the bare repo.
GitPython 3.0.4 and 3.0.5 are not able to get diffs
GitPython 3.0.6 is unable to read the bare repo.
GitPython 3.0.7 - 3.0.9, 3.1.0 are not able to get diffs
Test script and script outputs attached.
Test script is a Python 3 script named to diff_fail.script.txt because .py not supported as an upload.
diff_fail.script.txt
gitpython_3.0.2.output.txt
gitpython_3.1.0.output.txt
The text was updated successfully, but these errors were encountered: