From 5f3c27d1921d69abf6430db76749d87c8edcaeb9 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 28 Mar 2013 15:57:55 -0400 Subject: [PATCH 1/2] Add list commits for a repository --- github.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/github.js b/github.js index f9a1d726..15a2a3cf 100644 --- a/github.js +++ b/github.js @@ -419,6 +419,13 @@ }); }); }; + + // List commits on a repository + // ------- + + this.getCommits = function(cb) { + _request("GET", repoPath + "/commits", null, cb); + }; }; // Gists API @@ -496,4 +503,4 @@ return new Github.Gist({id: id}); }; }; -}).call(this); \ No newline at end of file +}).call(this); From 214dfdc6eb4fc499931bce7059b639b05bdcf527 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 28 Mar 2013 16:46:53 -0400 Subject: [PATCH 2/2] Add commit list options --- github.js | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/github.js b/github.js index 15a2a3cf..a200f805 100644 --- a/github.js +++ b/github.js @@ -420,11 +420,42 @@ }); }; - // List commits on a repository + // List commits on a repository. Takes an object of optional paramaters: + // sha: SHA or branch to start listing commits from + // path: Only commits containing this file path will be returned + // author: GitHub login, name, or email by which to filter by commit author + // since: ISO 8601 date - only commits after this date will be returned + // until: ISO 8601 date - only commits before this date will be returned // ------- - this.getCommits = function(cb) { - _request("GET", repoPath + "/commits", null, cb); + this.getCommits = function(cb, options) { + options = options || {}; + var url = repoPath + "/commits"; + var params = []; + if (options.sha) { + params.push("sha=" + encodeURIComponent(options.sha)); + } + if (options.path) { + params.push("path=" + encodeURIComponent(options.path)); + } + if (options.since) { + var since = options.since; + if (since.constructor === Date) { + since = since.toISOString(); + } + params.push("since=" + encodeURIComponent(since)); + } + if (options.until) { + var until = options.until; + if (until.constructor === Date) { + until = until.toISOString(); + } + params.push("until=" + encodeURIComponent(until)); + } + if (params.length > 0) { + url += "?" + params.join("&"); + } + _request("GET", url, null, cb); }; }; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy