Skip to content

Commit 59dd023

Browse files
author
Simon Coffey
committed
Remove #process_commmit_data indent parameter
This was introduced in [1] to handle variance in indentation when parsing commit messages; at the time the #process_commit_data method had two callers, one which used it to process log lines, and the other which used it to process the output of `git cat-file commit <SHA>`. The former sees a 4-space indent, the latter, zero. Since [2], however, the log processing has been handled by the #process_commit_log_data method, so #process_commit_data exclusively handles un-indented inputs, and we can remove the indent parameter. [1] 05117d4 [2] 97e1fff Signed-off-by: Simon Coffey <simon.coffey@futurelearn.com>
1 parent 2952ced commit 59dd023

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/git/lib.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ def object_size(sha)
221221
def commit_data(sha)
222222
sha = sha.to_s
223223
cdata = command_lines('cat-file', 'commit', sha)
224-
process_commit_data(cdata, sha, 0)
224+
process_commit_data(cdata, sha)
225225
end
226226

227-
def process_commit_data(data, sha = nil, indent = 4)
227+
def process_commit_data(data, sha = nil)
228228
hsh = {
229229
'sha' => sha,
230230
'parent' => []
@@ -238,7 +238,7 @@ def process_commit_data(data, sha = nil, indent = 4)
238238
end
239239
end
240240

241-
hsh['message'] = data.collect {|line| line[indent..-1]}.join("\n") + "\n"
241+
hsh['message'] = data.join("\n") + "\n"
242242

243243
return hsh
244244
end

0 commit comments

Comments
 (0)