Skip to content

Commit

Permalink
Tools: Add depth to git fetch in npm publishing (#33595)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored and sarayourfriend committed Jul 23, 2021
1 parent 6626ea1 commit 4fe49ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/plugin/commands/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ async function runWordPressReleaseBranchSyncStep(
gitWorkingDirectoryPath,
wordpressReleaseBranch
);
await git.fetch( gitWorkingDirectoryPath, [ '--depth=100' ] );
log(
'>> The local release branch ' +
formats.success( wordpressReleaseBranch ) +
Expand Down
12 changes: 12 additions & 0 deletions bin/plugin/lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -166,6 +177,7 @@ module.exports = {
checkoutRemoteBranch,
createLocalBranch,
createLocalTag,
fetch,
pushBranchToOrigin,
pushTagsToOrigin,
discardLocalChanges,
Expand Down

0 comments on commit 4fe49ad

Please sign in to comment.