From a2528a09e43e27f03dcf1bc14b2cb94d79c1d2b3 Mon Sep 17 00:00:00 2001 From: sentientwaffle Date: Fri, 17 Feb 2012 07:46:08 -0700 Subject: [PATCH] allow Repo#diff to receive commit shas --- src/repo.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/repo.coffee b/src/repo.coffee index 0efc4bd..0b122cf 100644 --- a/src/repo.coffee +++ b/src/repo.coffee @@ -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