Browse Source

Extended fetch form one specified branch to all branches on each remote in git.checkout task

Oskar Wrobel 9 years ago
parent
commit
006c3a9589
2 changed files with 5 additions and 5 deletions
  1. 4 4
      dev/tasks/dev/utils/git.js
  2. 1 1
      dev/tests/dev/git.js

+ 4 - 4
dev/tasks/dev/utils/git.js

@@ -66,7 +66,7 @@ module.exports = {
 	},
 
 	/**
-	 * Fetches and checks out branch on selected repository.
+	 * Fetches all remotes and checks out branch on selected repository.
 	 *
 	 * @param {String} repositoryLocation Absolute path to repository.
 	 * @param {String} branchName Name of the branch to checkout.
@@ -74,7 +74,7 @@ module.exports = {
 	checkout( repositoryLocation, branchName ) {
 		const checkoutCommands = [
 			`cd ${ repositoryLocation }`,
-			`git fetch origin ${ branchName }`,
+			`git fetch --all`,
 			`git checkout ${ branchName }`
 		];
 
@@ -88,12 +88,12 @@ module.exports = {
 	 * @param {String} branchName Branch name to pull.
 	 */
 	pull( repositoryLocation, branchName ) {
-		const checkoutCommands = [
+		const pullCommands = [
 			`cd ${ repositoryLocation }`,
 			`git pull origin ${ branchName }`
 		];
 
-		tools.shExec( checkoutCommands.join( ' && ' ) );
+		tools.shExec( pullCommands.join( ' && ' ) );
 	},
 
 	/**

+ 1 - 1
dev/tests/dev/git.js

@@ -151,7 +151,7 @@ describe( 'utils', () => {
 				const branchName = 'branch-to-checkout';
 				const checkoutCommands = [
 					`cd ${ repositoryLocation }`,
-					`git fetch origin ${ branchName }`,
+					`git fetch --all`,
 					`git checkout ${ branchName }`
 				].join( ' && ' );