Skip to content
Merged
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
11 changes: 10 additions & 1 deletion lib/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,12 @@ Repository.prototype.getRemote = function(remote, callback) {
*
* @param {String|Remote} remote
* @param {Object|RemoteCallback} remoteCallbacks Any custom callbacks needed
* @param {Bool} pruneAfter will perform a prune after the fetch if true
*/
Repository.prototype.fetch = function(
remote,
remoteCallbacks,
pruneAfter,
callback)
{
var repo = this;
Expand All @@ -608,6 +610,11 @@ Repository.prototype.fetch = function(
remote.setCallbacks(remoteCallbacks);

return remote.fetch(null, repo.defaultSignature(), "Fetch from " + remote)
.then(function() {
if (pruneAfter) {
remote.prune();
}
})
.then(function() {
return remote.disconnect();
}).then(function() {
Expand All @@ -621,9 +628,11 @@ Repository.prototype.fetch = function(
/**
* Fetches from all remotes
* @param {Object|RemoteCallback} remoteCallbacks Any custom callbacks needed
* @param {Bool} pruneAfter will perform a prune after the fetch if true
*/
Repository.prototype.fetchAll = function(
remoteCallbacks,
pruneAfter,
callback)
{
var repo = this;
Expand All @@ -633,7 +642,7 @@ Repository.prototype.fetchAll = function(

remotes.forEach(function(remote) {
fetchPromises.push(
repo.fetch(remote, remoteCallbacks, callback));
repo.fetch(remote, remoteCallbacks, pruneAfter, callback));
});

return Promise.all(fetchPromises);
Expand Down