Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ Retrieve all available branches (aka heads) of a repository.
repo.listBranches(function(err, branches) {});
```

Get list of statuses for a particular commit.

```js
repo.getStatuses(sha, function(err, statuses) {});
```

Store contents at a certain path, where files that don't yet exist are created on the fly.
You can also provide an optional object literal, (`options` in the example below) containing information about the author and the committer.

Expand Down
12 changes: 12 additions & 0 deletions github.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@
});
};

// Get the statuses for a particular SHA
// -------

this.getStatuses = function(sha, cb) {
_request('GET', repoPath + '/statuses/' + sha, null, function(err, heads, xhr) {
if (err) {
return cb(err);
}
cb(null, heads, xhr);
})
};

// Retrieve the tree a commit points to
// -------

Expand Down
10 changes: 10 additions & 0 deletions test/test.repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ describe('Github.Repository', function() {
});
});

it('should get statuses for a SHA from a repo', function(done) {
repo.getStatuses('20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, statuses) {
statuses.length.should.equal(6)
statuses.every(function(status) {
return status.url === 'https://api.github.com/repos/michael/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b'
}).should.equal(true);
done();
});
});

it('should get a SHA from a repo', function(done) {
repo.getSha('master', '.gitignore', function(err, sha) {
should.not.exist(err);
Expand Down