From ef7e72033675d69ce2560fde4d365a2e576c1b9d Mon Sep 17 00:00:00 2001 From: Antonio D'Ettole Date: Fri, 14 Dec 2012 17:03:38 +0100 Subject: [PATCH 1/2] Added repo.getCommits --- github.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/github.js b/github.js index dc6f7e98..2c23b220 100644 --- a/github.js +++ b/github.js @@ -306,6 +306,13 @@ }); }; + // Get a repo's commits + this.getCommits = function(cb) { + _request("GET", repoPath + "/commits", null, function(err, res) { + cb(err, res); + }); + }; + // Update the reference of your head to point to the new commit SHA // ------- From a56f7d058e4acb7e67c517b2a9ce59b922ce7096 Mon Sep 17 00:00:00 2001 From: Antonio D'Ettole Date: Fri, 14 Dec 2012 17:12:39 +0100 Subject: [PATCH 2/2] Added repo.postTreeFromBase --- github.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/github.js b/github.js index 2c23b220..b20ce071 100644 --- a/github.js +++ b/github.js @@ -283,6 +283,17 @@ }); }; + // post a new tre object specifying a base tree + // @param String baseTree the sha of the base tree + this.postTreeFromBase = function(tree, baseTree, cb){ + var postData = { "tree": tree }; + if(baseTree && typeof(baseTree) == 'string' && baseTree.length > 0) postData['base_tree'] = baseTree; + _request("POST", repoPath + "/git/trees", postData, function(err, res) { + if (err) return cb(err); + cb(null, res.sha); + }); + } + // Create a new commit object with the current commit SHA as the parent // and the new tree SHA, getting a commit SHA back // -------