@@ -596,10 +596,12 @@ Repository.prototype.getRemote = function(remote, callback) {
596596 *
597597 * @param {String|Remote } remote
598598 * @param {Object|RemoteCallback } remoteCallbacks Any custom callbacks needed
599+ * @param {Bool } pruneAfter will perform a prune after the fetch if true
599600 */
600601Repository . prototype . fetch = function (
601602 remote ,
602603 remoteCallbacks ,
604+ pruneAfter ,
603605 callback )
604606{
605607 var repo = this ;
@@ -608,6 +610,11 @@ Repository.prototype.fetch = function(
608610 remote . setCallbacks ( remoteCallbacks ) ;
609611
610612 return remote . fetch ( null , repo . defaultSignature ( ) , "Fetch from " + remote )
613+ . then ( function ( ) {
614+ if ( pruneAfter ) {
615+ remote . prune ( ) ;
616+ }
617+ } )
611618 . then ( function ( ) {
612619 return remote . disconnect ( ) ;
613620 } ) . then ( function ( ) {
@@ -621,9 +628,11 @@ Repository.prototype.fetch = function(
621628/**
622629 * Fetches from all remotes
623630 * @param {Object|RemoteCallback } remoteCallbacks Any custom callbacks needed
631+ * @param {Bool } pruneAfter will perform a prune after the fetch if true
624632 */
625633Repository . prototype . fetchAll = function (
626634 remoteCallbacks ,
635+ pruneAfter ,
627636 callback )
628637{
629638 var repo = this ;
@@ -633,7 +642,7 @@ Repository.prototype.fetchAll = function(
633642
634643 remotes . forEach ( function ( remote ) {
635644 fetchPromises . push (
636- repo . fetch ( remote , remoteCallbacks , callback ) ) ;
645+ repo . fetch ( remote , remoteCallbacks , pruneAfter , callback ) ) ;
637646 } ) ;
638647
639648 return Promise . all ( fetchPromises ) ;
0 commit comments