-
-
Notifications
You must be signed in to change notification settings - Fork 933
blame doesn't preserve multi-line commit messages #485
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
When blaming, you will receive |
Yes, I am referring to those Here, I made some easy scripts to run to reproduce this. Run the first to set up the git env (in a new directory) and then run the second to see that only the first line of the commit message is displayed. #!/bin/bash
rm ./some-file
rm -rf ./.git/
git init
echo "this is" >> some-file
echo "some text" >> some-file
git add some-file
git commit -m "Initial commit"
echo "some more text" >> some-file
git add some-file
git commit -m "Commit two summary
More detailed text here
Could be really detailed :)
Blah blah blah" import git
repo = git.Repo("./")
def get_incremental():
for blame_entry in repo.blame_incremental('HEAD', 'some-file'):
if 3 in blame_entry.linenos:
return blame_entry
def get_non_incremental():
for commit, lines in repo.blame('HEAD', 'some-file'):
if 'some more text' in lines:
return commit
print(get_incremental().commit.message)
print(get_non_incremental().message) |
Thanks for the feedback ! It's clear to me now why this indeed doesn't work as expected. |
The
Commit
objects returned byblame
andblame_incremental
only contain the first line of the commit message (the summary).Obviously, it is harder to return the full commit message because
git blame -p
only returns the summary.The text was updated successfully, but these errors were encountered: