proper shallow check

This commit is contained in:
Dario Dorando 2023-09-06 15:33:17 +03:00
parent e0776265c5
commit 619bfb4fa4

View file

@ -114,11 +114,7 @@ export class GitCommandManager {
} }
args.push('--progress', '--no-recurse-submodules') args.push('--progress', '--no-recurse-submodules')
if ( if (await this.isShallow()) {
utils.fileExistsSync(
realpathSync(path.join(this.workingDirectory, '.git', 'shallow'))
)
) {
args.push('--unshallow') args.push('--unshallow')
} }
@ -164,6 +160,11 @@ export class GitCommandManager {
return this.workingDirectory return this.workingDirectory
} }
async isShallow(): Promise<boolean> {
const result = await this.revParse('', ['--is-shallow-repository'])
return result === 'true'
}
async hasDiff(options?: string[]): Promise<boolean> { async hasDiff(options?: string[]): Promise<boolean> {
const args = ['diff', '--quiet'] const args = ['diff', '--quiet']
if (options) { if (options) {