Skip to content

Commit

Permalink
indent parameter for parsing commit data
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mendler committed Feb 9, 2009
1 parent 61d3d4e commit 05117d4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/git/lib.rb
Expand Up @@ -122,10 +122,10 @@ def object_size(sha)
def commit_data(sha)
sha = sha.to_s
cdata = command_lines('cat-file', ['commit', sha])
process_commit_data(cdata, sha)
process_commit_data(cdata, sha, 0)
end

def process_commit_data(data, sha = nil)
def process_commit_data(data, sha = nil, indent = 4)
in_message = false

if sha
Expand All @@ -139,8 +139,7 @@ def process_commit_data(data, sha = nil)
if line == ''
in_message = !in_message
elsif in_message
hsh['message'] << "\n" if hsh['message'] != ''
hsh['message'] << line[4..-1]
hsh['message'] << line[indent..-1] << "\n"
else
data = line.split
key = data.shift
Expand Down

0 comments on commit 05117d4

Please sign in to comment.