diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index 4f2b792..b9438a9 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -114,11 +114,7 @@ export class GitCommandManager { } args.push('--progress', '--no-recurse-submodules') - if ( - utils.fileExistsSync( - realpathSync(path.join(this.workingDirectory, '.git', 'shallow')) - ) - ) { + if (await this.isShallow()) { args.push('--unshallow') } @@ -164,6 +160,11 @@ export class GitCommandManager { return this.workingDirectory } + async isShallow(): Promise { + const result = await this.revParse('', ['--is-shallow-repository']) + return result === 'true' + } + async hasDiff(options?: string[]): Promise { const args = ['diff', '--quiet'] if (options) {