1
0
mirror of https://github.com/danog/gift.git synced 2024-11-30 04:19:37 +01:00

allow Repo#diff to receive commit shas

This commit is contained in:
sentientwaffle 2012-02-17 07:46:08 -07:00
parent ce62b82899
commit a2528a09e4

View File

@ -62,14 +62,16 @@ module.exports = class Repo
# Public: Get the difference between the trees.
#
# commitA - A Commit.
# commitB - A Commit.
# commitA - A Commit or String commit id.
# commitB - A Commit or String commit id.
# paths - A list of String paths to restrict the difference to (optional).
# callback - A Function which receives `(err, diffs)`.
#
diff: (commitA, commitB, paths, callback) ->
[callback, paths] = [paths, callback] if !callback
paths ?= []
commitA = commitA.id if _.isObject(commitA)
commitB = commitB.id if _.isObject(commitB)
@git "diff", {}, _.flatten([commitA, commitB, "--", paths])
, (err, stdout, stderr) =>
return callback err if err