FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add option to `fetch` to prune the remote afterwards by johnhaley81 · Pull Request #476 · nodegit/nodegit · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 10 additions & 1 deletion lib/repository.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL