Skip to content
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

Bug: Crash in Repo._load_git_data when .git-blame-ignore-revs does not exist #54

Closed
rzuckerm opened this issue Feb 4, 2023 · 3 comments · Fixed by #55
Closed

Bug: Crash in Repo._load_git_data when .git-blame-ignore-revs does not exist #54

rzuckerm opened this issue Feb 4, 2023 · 3 comments · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@rzuckerm
Copy link
Contributor

rzuckerm commented Feb 4, 2023

For older version of git, such as 2.34.1, git blame errors out if .git-blame-ignore-revs does not exist. A crash occurs in repo.py line 271 due to this issue. I guess the reason why this hasn't been an issue is that GitHub seems to be using git 2.39.1.

@rzuckerm
Copy link
Contributor Author

rzuckerm commented Feb 4, 2023

I think the solution is to touch that file after cloning to be backward compatible with old versions of git. Please assign this to me.

@rzuckerm
Copy link
Contributor Author

rzuckerm commented Feb 4, 2023

Here are the details of the crash when running the tests:

tests/test_integration.py:3: in <module>
    TEST_REPO = subete.load()
subete/__init__.py:21: in load
    return Repo(source_dir=source_dir)
subete/repo.py:35: in __init__
    self._load_git_data()
subete/repo.py:271: in _load_git_data
    blame = self._git_repo.blame('HEAD', f"{program._path}/{program._file_name}")
venv/lib/python3.7/site-packages/git/repo/base.py:876: in blame
    data = self.git.blame(rev, '--', file, p=True, stdout_as_string=False, **kwargs)
venv/lib/python3.7/site-packages/git/cmd.py:585: in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
venv/lib/python3.7/site-packages/git/cmd.py:1124: in _call_process
    return self.execute(call, **exec_kwargs)
venv/lib/python3.7/site-packages/git/cmd.py:928: in execute
    raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
E   git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
E     cmdline: git blame -p HEAD -- /tmp/tmp6ouuhm62/archive/a/abap/hello-world.abap
E     stderr: 'fatal: could not open object name list: .git-blame-ignore-revs'

@jrg94
Copy link
Member

jrg94 commented Feb 6, 2023

Really nice catch!

@jrg94 jrg94 closed this as completed in #55 Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants