Skip to content

Incorrect log if repo contains commits with empty message #481

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
kpd200081 opened this issue Aug 10, 2020 · 0 comments · Fixed by #482
Closed

Incorrect log if repo contains commits with empty message #481

kpd200081 opened this issue Aug 10, 2020 · 0 comments · Fixed by #482

Comments

@kpd200081
Copy link
Contributor

kpd200081 commented Aug 10, 2020

Subject of the issue

If repository contains commit made by git commit --allow-empty --allow-empty-message -m "" log return incorrect commits history. Returned history starts from this commit with empty message.

Your environment

$ git --version
git version 2.20.1
$ sudo gem install git     
Successfully installed git-1.7.0
$ ruby --version 
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]

Steps to reproduce

Create testing git repository:

mkdir test
cd test
git init
git commit -m "test" --allow-empty
git commit -m "test2" --allow-empty
git commit -m "" --allow-empty --allow-empty-message
git commit -m "test3" --allow-empty

Get real commit history:

$ git log | tee test
commit fc940fc8858011566d6a16076d01bcf189955b37
Author: ...
Date:   Mon Aug 10 17:34:10 2020 +0300

    test3

commit 58dc8ed01e328ea4cea39b28a01aa4500be5e385
Author: ...
Date:   Mon Aug 10 17:34:02 2020 +0300

commit 458f6e6b9305df15a9c23c3dffaf7448d917c72f
Author: ...
Date:   Mon Aug 10 17:33:43 2020 +0300

    test2

commit 9dd305fe98ef19385906e39cdb31ee7696f53e03
Author: ...
Date:   Mon Aug 10 17:33:37 2020 +0300

    test

Create test ruby script (named test.rb):

require "git"

g = Git.open("~/test")

g.log.to_a.each do |com|
   puts com.sha 
end

Call it:

$ ruby test.rb                                                 
fc940fc8858011566d6a16076d01bcf189955b37
58dc8ed01e328ea4cea39b28a01aa4500be5e385

As we can see this is not all commit history.

Expected behaviour

Retrieving complete commit history

Actual behaviour

The commit history is truncated from a commit with an empty message

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