diff --git a/bin/plugin/commands/packages.js b/bin/plugin/commands/packages.js index 95173227f72d81..fe421c2c1d25b7 100644 --- a/bin/plugin/commands/packages.js +++ b/bin/plugin/commands/packages.js @@ -65,6 +65,7 @@ async function runWordPressReleaseBranchSyncStep( gitWorkingDirectoryPath, wordpressReleaseBranch ); + await git.fetch( gitWorkingDirectoryPath, [ '--depth=100' ] ); log( '>> The local release branch ' + formats.success( wordpressReleaseBranch ) + diff --git a/bin/plugin/lib/git.js b/bin/plugin/lib/git.js index 64b4c532b6c623..3b16df953ab423 100644 --- a/bin/plugin/lib/git.js +++ b/bin/plugin/lib/git.js @@ -26,6 +26,17 @@ async function clone( repositoryUrl ) { return gitWorkingDirectoryPath; } +/** + * Fetches changes from the repository. + * + * @param {string} gitWorkingDirectoryPath Local repository path. + * @param {string[]|Object} options Git options to apply. + */ +async function fetch( gitWorkingDirectoryPath, options = [] ) { + const simpleGit = SimpleGit( gitWorkingDirectoryPath ); + await simpleGit.fetch( options ); +} + /** * Commits changes to the repository. * @@ -166,6 +177,7 @@ module.exports = { checkoutRemoteBranch, createLocalBranch, createLocalTag, + fetch, pushBranchToOrigin, pushTagsToOrigin, discardLocalChanges,