diff --git a/__test__/git-command-manager.test.ts b/__test__/git-command-manager.test.ts index cea73d4..30a44d2 100644 --- a/__test__/git-command-manager.test.ts +++ b/__test__/git-command-manager.test.ts @@ -133,6 +133,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--prune', '--no-recurse-submodules', @@ -170,6 +174,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--no-tags', '--prune', @@ -208,6 +216,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--no-tags', '--prune', @@ -247,6 +259,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--prune', '--no-recurse-submodules', @@ -284,6 +300,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--no-tags', '--prune', @@ -323,6 +343,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--no-tags', '--prune', @@ -363,6 +387,10 @@ describe('Test fetchDepth and fetchTags options', () => { [ '-c', 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', 'fetch', '--prune', '--no-recurse-submodules', diff --git a/dist/index.js b/dist/index.js index 46de4b6..74f505d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1559,7 +1559,15 @@ class GitCommandManager { } fetch(refSpec, options) { return __awaiter(this, void 0, void 0, function* () { - const args = ['-c', 'protocol.version=2', 'fetch']; + const args = [ + '-c', + 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', + 'fetch' + ]; if (!refSpec.some(x => x === refHelper.tagsRefSpec) && !options.fetchTags) { args.push('--no-tags'); } @@ -1581,7 +1589,8 @@ class GitCommandManager { args.push(arg); } const that = this; - yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () { + const fetchRetryHelper = new retryHelper.RetryHelper(3, 1, 5); + yield fetchRetryHelper.execute(() => __awaiter(this, void 0, void 0, function* () { yield that.execGit(args); })); }); diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index a45e15a..58a8a3d 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -284,7 +284,15 @@ class GitCommandManager { showProgress?: boolean } ): Promise { - const args = ['-c', 'protocol.version=2', 'fetch'] + const args = [ + '-c', + 'protocol.version=2', + '-c', + 'http.lowSpeedLimit=1000', + '-c', + 'http.lowSpeedTime=15', + 'fetch' + ] if (!refSpec.some(x => x === refHelper.tagsRefSpec) && !options.fetchTags) { args.push('--no-tags') } @@ -314,7 +322,8 @@ class GitCommandManager { } const that = this - await retryHelper.execute(async () => { + const fetchRetryHelper = new retryHelper.RetryHelper(3, 1, 5) + await fetchRetryHelper.execute(async () => { await that.execGit(args) }) }