From 2480cc2a7d4d4463aa6f5258936f4e928977e631 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Wed, 13 Apr 2022 15:10:06 +0900 Subject: [PATCH] cml ci: unshallow repos --- src/cml.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cml.js b/src/cml.js index a38d73717..cbc7b2c53 100755 --- a/src/cml.js +++ b/src/cml.js @@ -1,8 +1,10 @@ const { execSync } = require('child_process'); +const fs = require('fs').promises; const gitUrlParse = require('git-url-parse'); const stripAuth = require('strip-url-auth'); const globby = require('globby'); const git = require('simple-git')('./'); +const path = require('path'); const winston = require('winston'); @@ -335,6 +337,13 @@ class CML { const driver = getDriver(this); const command = await driver.updateGitConfig({ userName, userEmail }); await exec(command); + const gitDir = execSync(`git rev-parse --git-dir`).toString('utf8'); + try { + fs.accessSync(path.join(gitDir, 'shallow')) + await exec('git fetch --unshallow'); + } catch (err) { + // repo not shallow + } await exec('git fetch --all'); }