From c58e1018dc594757268f47448babaff6d10c4809 Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Mon, 20 Jun 2016 11:19:19 +0100 Subject: [PATCH] refactor: Repository.move filters nodes instead of deleting their sha closes #215 --- lib/Repository.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Repository.js b/lib/Repository.js index de77ae48..2ae7e276 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -588,11 +588,9 @@ class Repository extends Requestable { if (ref.path === oldPath) { ref.path = newPath; } - if (ref.type === 'tree') { - delete ref.sha; - } return ref; - }); + }) + .filter((ref) => ref.type !== 'tree'); return this.createTree(newTree); }) .then(({data: tree}) => this.commit(oldSha, tree.sha, `Renamed '${oldPath}' to '${newPath}'`))