mirror of
https://github.com/danog/gift.git
synced 2024-11-26 20:04:47 +01:00
added sha hash of the files being diff'd to diffs
This commit is contained in:
parent
6531a0a0b6
commit
70dd9e2e58
@ -4,9 +4,12 @@ module.exports = class Diff
|
||||
constructor: (@repo, @a_path, @b_path, a_blob, b_blob
|
||||
, @a_mode, @b_mode, @new_file, @deleted_file, @diff
|
||||
, @renamed_file=false, @similarity_index=0) ->
|
||||
@a_blob = new Blob @repo, {id: a_blob} if a_blob
|
||||
@b_blob = new Blob @repo, {id: b_blob} if b_blob
|
||||
|
||||
if a_blob isnt null
|
||||
@a_blob = new Blob @repo, {id: a_blob}
|
||||
@a_sha = a_blob
|
||||
if b_blob isnt null
|
||||
@b_blob = new Blob @repo, {id: b_blob}
|
||||
@b_sha = b_blob
|
||||
|
||||
toJSON: ->
|
||||
{@a_path, @b_path, @a_mode, @b_mode, @new_file
|
||||
@ -22,6 +25,7 @@ module.exports = class Diff
|
||||
diffs = []
|
||||
|
||||
while lines.length && lines[0]
|
||||
# FIXME shift is O(n), so iterating n over O(n) operation might be O(n^2)
|
||||
[m, a_path, b_path] = ///^diff\s--git\s"?a/(.+?)"?\s"?b/(.+)"?$///.exec lines.shift()
|
||||
|
||||
if /^old mode/.test lines[0]
|
||||
|
Loading…
Reference in New Issue
Block a user