From 6a8c93a5b2365a948640a13dc0898cedf2812c6c Mon Sep 17 00:00:00 2001 From: OHTAKE Tomohiro Date: Thu, 12 Sep 2013 15:54:29 +0900 Subject: [PATCH 1/2] Handle commits with empty lines in the message --- lib/git/lib.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 47886776..b76285ba 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -139,8 +139,10 @@ def process_commit_data(data, sha = nil, indent = 4) data.each do |line| line = line.chomp - if line == '' + if line == '' and hsh_array in_message = !in_message + elsif line == '' and !hsh_array and !in_message + in_message = true elsif in_message hsh['message'] << line[indent..-1] << "\n" else From 773e818f945db62a81e456fc011f48a402cdb6a3 Mon Sep 17 00:00:00 2001 From: Naoto TAKAHASHI Date: Thu, 12 Sep 2013 16:53:25 +0900 Subject: [PATCH 2/2] Add test for empry lines in commit message --- .../32/77d9f9880e662bf701c7f42a50db6e5053b001 | Bin 0 -> 173 bytes .../files/working.git/refs/heads/test_empty_lines | 1 + .../32/77d9f9880e662bf701c7f42a50db6e5053b001 | Bin 0 -> 173 bytes .../working/dot_git/refs/heads/test_empty_lines | 1 + tests/units/test_object.rb | 7 ++++++- 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/files/working.git/objects/32/77d9f9880e662bf701c7f42a50db6e5053b001 create mode 100644 tests/files/working.git/refs/heads/test_empty_lines create mode 100644 tests/files/working/dot_git/objects/32/77d9f9880e662bf701c7f42a50db6e5053b001 create mode 100644 tests/files/working/dot_git/refs/heads/test_empty_lines diff --git a/tests/files/working.git/objects/32/77d9f9880e662bf701c7f42a50db6e5053b001 b/tests/files/working.git/objects/32/77d9f9880e662bf701c7f42a50db6e5053b001 new file mode 100644 index 0000000000000000000000000000000000000000..a4bae240bbe8c7f20110acff16de91ba7923ffd6 GIT binary patch literal 173 zcmV;e08;;W0iBLXY6CG40CVnF=x%IU-5M