Skip to content

Commit

Permalink
allow Repo#diff to receive commit shas
Browse files Browse the repository at this point in the history
  • Loading branch information
sentientwaffle committed Feb 17, 2012
1 parent ce62b82 commit a2528a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/repo.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a2528a0

Please sign in to comment.