From e4f4880b849e07e19233e25f83aa70f008e10126 Mon Sep 17 00:00:00 2001 From: philippsimon Date: Mon, 7 Dec 2015 18:31:14 +0100 Subject: [PATCH 1/3] fetch also all branches --- tasks/deploy/fetch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/deploy/fetch.js b/tasks/deploy/fetch.js index f1edf53..1213973 100644 --- a/tasks/deploy/fetch.js +++ b/tasks/deploy/fetch.js @@ -95,7 +95,8 @@ module.exports = function (gruntOrShipit) { function fetch() { var fetchCommand = 'git fetch' + (shipit.config.shallowClone ? ' --depth=1 ' : ' ') + - 'shipit -p --tags'; + 'shipit --prune'; + fetchCommand = fetchCommand + ' && ' + fetchCommand + ' --tags'; shipit.log('Fetching repository "%s"', shipit.config.repositoryUrl); From d1fc6498ecae339cd989f6c23360f6d6c2b54c40 Mon Sep 17 00:00:00 2001 From: philippsimon Date: Tue, 8 Dec 2015 09:22:22 +0100 Subject: [PATCH 2/3] fetch branches and tags --- tasks/deploy/fetch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/deploy/fetch.js b/tasks/deploy/fetch.js index 1213973..7592eda 100644 --- a/tasks/deploy/fetch.js +++ b/tasks/deploy/fetch.js @@ -96,7 +96,8 @@ module.exports = function (gruntOrShipit) { var fetchCommand = 'git fetch' + (shipit.config.shallowClone ? ' --depth=1 ' : ' ') + 'shipit --prune'; - fetchCommand = fetchCommand + ' && ' + fetchCommand + ' --tags'; + // fetch branches and tags separate to be compatible with git versions < 1.9 + fetchCommand += ' && ' + fetchCommand + ' "refs/tags/*:refs/tags/*"'; shipit.log('Fetching repository "%s"', shipit.config.repositoryUrl); From 9299edfeaeb417c2f1a68deca5d59e724a6cb30c Mon Sep 17 00:00:00 2001 From: philippsimon Date: Tue, 8 Dec 2015 09:35:38 +0100 Subject: [PATCH 3/3] fix tests --- test/unit/tasks/deploy/fetch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/tasks/deploy/fetch.js b/test/unit/tasks/deploy/fetch.js index d3c62c2..12c2532 100644 --- a/test/unit/tasks/deploy/fetch.js +++ b/test/unit/tasks/deploy/fetch.js @@ -47,7 +47,7 @@ describe('deploy:fetch task', function () { 'git remote add shipit git://website.com/user/repo', {cwd: '/tmp/workspace'} ); - expect(shipit.local).to.be.calledWith('git fetch shipit -p --tags', {cwd: '/tmp/workspace'}); + expect(shipit.local).to.be.calledWith('git fetch shipit --prune && git fetch shipit --prune "refs/tags/*:refs/tags/*"', {cwd: '/tmp/workspace'}); expect(shipit.local).to.be.calledWith('git checkout master', {cwd: '/tmp/workspace'}); expect(shipit.local).to.be.calledWith('git branch --list master', {cwd: '/tmp/workspace'}); done(); @@ -67,7 +67,7 @@ describe('deploy:fetch task', function () { 'git remote add shipit git://website.com/user/repo', {cwd: '/tmp/workspace'} ); - expect(shipit.local).to.be.calledWith('git fetch --depth=1 shipit -p --tags', {cwd: '/tmp/workspace'}); + expect(shipit.local).to.be.calledWith('git fetch --depth=1 shipit --prune && git fetch --depth=1 shipit --prune "refs/tags/*:refs/tags/*"', {cwd: '/tmp/workspace'}); expect(shipit.local).to.be.calledWith('git checkout master', {cwd: '/tmp/workspace'}); expect(shipit.local).to.be.calledWith('git branch --list master', {cwd: '/tmp/workspace'}); done();