@@ -4,7 +4,7 @@ import fs from 'node:fs'
44import fsp from 'node:fs/promises'
55import { startSubprocess } from '@nuxt/devtools-kit'
66import { dirname , join } from 'pathe'
7- import Git from 'simple-git '
7+ import { x } from 'tinyexec '
88import { glob } from 'tinyglobby'
99
1010const COLON_RE = / : / g
@@ -87,14 +87,18 @@ export function setupAnalyzeBuildRPC({ nuxt, refresh, ensureDevAuthToken }: Nuxt
8787 return builds . sort ( ( a , b ) => b . endTime - a . endTime )
8888 }
8989
90+ async function git ( ...args : string [ ] ) : Promise < string > {
91+ const result = await x ( 'git' , args , { nodeOptions : { cwd : nuxt . options . rootDir } , throwOnError : true } )
92+ return result . stdout . trim ( )
93+ }
94+
9095 async function generateAnalyzeBuildName ( ) {
9196 try {
92- const git = Git ( nuxt . options . rootDir )
93- const branch = await git . branch ( )
94- const branchName = branch . current || 'head'
95- const sha = await git . revparse ( [ '--short' , 'HEAD' ] )
96- const isWorkingTreeClean = ( await git . status ( ) ) . isClean ( )
97- if ( isWorkingTreeClean )
97+ const branchName = await git ( 'rev-parse' , '--abbrev-ref' , 'HEAD' ) || 'head'
98+ const sha = await git ( 'rev-parse' , '--short' , 'HEAD' )
99+ const status = await git ( 'status' , '--porcelain' )
100+ const isClean = status === ''
101+ if ( isClean )
98102 return `${ branchName } #${ sha } `
99103 return `${ branchName } #${ sha } -dirty`
100104 }
0 commit comments