Skip to content

#993 fix: wrong refs 'HEAD' exception #999

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

Merged
merged 1 commit into from
Mar 21, 2020

Conversation

dongs0104
Copy link
Contributor

@dongs0104 dongs0104 commented Mar 18, 2020

When git HEAD refs is broken, it raise BadName exception.
so submodules logic which is using a rev_parse function to HEAD get Exception, so handle BadName to return empty list

b303cb0

GitPython/git/diff.py

Lines 281 to 287 in b303cb0

# Determine whether this diff references a submodule, if it does then
# we need to overwrite "repo" to the corresponding submodule's repo instead
if repo and a_rawpath:
for submodule in repo.submodules:
if submodule.path == a_rawpath.decode("utf-8"):
repo = submodule.module()
break

@Byron
Copy link
Member

Byron commented Mar 21, 2020

Thanks a lot for your contribution :)! It's much appreciated.

CC: #993 , where diff is broken due to a very similar issue.

@Byron Byron added this to the v3.1.1 - Bugfixes milestone Mar 21, 2020
@Byron Byron merged commit 5db2e0c into gitpython-developers:master Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants