From 8fffa569fc19cb98a7b37c9e6c13b4311b83b61b Mon Sep 17 00:00:00 2001 From: Aymen Mouelhi Date: Fri, 14 Apr 2017 12:35:25 +0200 Subject: [PATCH 1/3] Add recursive parameter in Repository.getTree --- lib/Repository.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Repository.js b/lib/Repository.js index d338b261..ee11f50e 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} treeSHA - the SHA of the tree to fetch * @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) => { From fa6b417d3a836aeb53e087c5be5d328cac575c47 Mon Sep 17 00:00:00 2001 From: Aymen Mouelhi Date: Fri, 14 Apr 2017 12:40:14 +0200 Subject: [PATCH 2/3] Add recursive parameter in Repository.getTree --- lib/Repository.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Repository.js b/lib/Repository.js index ee11f50e..51a75869 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -235,7 +235,7 @@ 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} 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 */ From 7745abded1e3fe9a24f5bd875e40f18142c2abe4 Mon Sep 17 00:00:00 2001 From: Aymen Mouelhi Date: Fri, 14 Apr 2017 12:44:54 +0200 Subject: [PATCH 3/3] Add recursive parameter in Repository.getTree --- lib/Repository.js | 2 +- test/repository.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Repository.js b/lib/Repository.js index 51a75869..0ebea37f 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -241,7 +241,7 @@ class Repository extends Requestable { */ getTree(treeSHA, recursive, cb) { recursive = recursive ? '?recursive=true' : ''; - return this._request('GET', `/repos/${this.__fullname}/git/trees/${treeSHA}/${recursive}`, null, cb); + return this._request('GET', `/repos/${this.__fullname}/git/trees/${treeSHA}${recursive}`, null, cb); } /** 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