diff --git a/lib/Repository.js b/lib/Repository.js index d338b261..0ebea37f 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -235,11 +235,13 @@ class Repository extends Requestable { * Get a description of a git tree * @see https://developer.github.com/v3/git/trees/#get-a-tree * @param {string} treeSHA - the SHA of the tree to fetch + * @param {boolean} recursive - Get tree recursively or not * @param {Requestable.callback} cb - will receive the callback data * @return {Promise} - the promise for the http request */ - getTree(treeSHA, cb) { - return this._request('GET', `/repos/${this.__fullname}/git/trees/${treeSHA}`, null, cb); + getTree(treeSHA, recursive, cb) { + recursive = recursive ? '?recursive=true' : ''; + return this._request('GET', `/repos/${this.__fullname}/git/trees/${treeSHA}${recursive}`, null, cb); } /** @@ -680,7 +682,7 @@ class Repository extends Requestable { move(branch, oldPath, newPath, cb) { let oldSha; return this.getRef(`heads/${branch}`) - .then(({data: {object}}) => this.getTree(`${object.sha}?recursive=true`)) + .then(({data: {object}}) => this.getTree(`${object.sha}`, true)) .then(({data: {tree, sha}}) => { oldSha = sha; let newTree = tree.map((ref) => { diff --git a/test/repository.spec.js b/test/repository.spec.js index ef5101cf..eee77e76 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -99,7 +99,7 @@ describe('Repository', function() { }); it('should get tree', function(done) { - remoteRepo.getTree('master', assertSuccessful(done, function(err, response) { + remoteRepo.getTree('master', true, assertSuccessful(done, function(err, response) { let {tree} = response; expect(tree).to.be.an.array(); expect(tree.length).to.be.above(0); 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