Skip to content

Crash when parsing commit message #16

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

Closed
djdeath opened this issue Oct 10, 2010 · 2 comments
Closed

Crash when parsing commit message #16

djdeath opened this issue Oct 10, 2010 · 2 comments
Milestone

Comments

@djdeath
Copy link

djdeath commented Oct 10, 2010

Here is the stack :

/usr/lib/ruby/1.8/git/lib.rb:148:in process_commit_data': undefined method<<' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/1.8/git/lib.rb:135:in each' from /usr/lib/ruby/1.8/git/lib.rb:135:inprocess_commit_data'
from /usr/lib/ruby/1.8/git/lib.rb:123:in commit_data' from /usr/lib/ruby/1.8/git/object.rb:230:incheck_commit'
from /usr/lib/ruby/1.8/git/object.rb:197:in committer' from /usr/lib/ruby/1.8/git/object.rb:202:incommitter_date'
from /home/djdeath/bin/confront_patch_list.rb:32
from /home/djdeath/bin/confront_patch_list.rb:27:in `each_key'
from /home/djdeath/bin/confront_patch_list.rb:27

It happens when I call the committer_date method with something like this :

repo = Git::Base.open("#{ENV['PWD']}")
ob = Git::Object::Commit.new(repo, "whatevercommithash")
puts ob.committer_date

The problem is in the process_commit_data method in lib.rb because this method expects the commit's metadatas to be separated from the commit's comment by an empty line. But it does not expect the commit to contain a empty line too.

Here is what the commit triggering this crash looks like :

$ git cat-file commit a693b0cdba94f60f7ed43754d2c34151cdd11da5
tree 99cbf46748dfa4f35acc1d63ae51817f3e17ec9d
parent 484ab62c5ee805c2bdc405a85a4e64da2722690f
author Mauro Carvalho Chehab mchehab@redhat.com 1228161854 -0200
committer Mauro Carvalho Chehab mchehab@redhat.com 1228161854 -0200

em28xx: remove backward compat macro added on a previous fix

commit 50f3beb50abe0cc0228363af804e50e710b3e5b0 fixed em28xx-alsa
locking schema. However, a backport macro was kept.

This patch removes the macro, since it is not needed for the module
compilation against upstream.

Signed-off-by: Mauro Carvalho Chehab mchehab@redhat.com

So the fix is pretty easy, on lib.rb line 137 you have :

    if line == ''

Replace it by :

    if line == '' and not in_message                                       

Regards,

Lionel Landwerlin

@williscool
Copy link

know that this a while after it would probably be useful to you but I think you had the same issue I did

I fixed it here

upscalews@1fe5b80

@robertodecurnex
Copy link
Contributor

Working over this on #30
Ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants