@@ -34,7 +34,8 @@ const GitWarnings = [
3434 / d o e s n o t h a v e a n y c o m m i t s / ,
3535 / P a t h \' .* ?\' d o e s n o t e x i s t i n / ,
3636 / P a t h \' .* ?\' e x i s t s o n d i s k , b u t n o t i n / ,
37- / n o u p s t r e a m c o n f i g u r e d f o r b r a n c h /
37+ / n o u p s t r e a m c o n f i g u r e d f o r b r a n c h / ,
38+ / a m b i g u o u s a r g u m e n t ' .* ?' : u n k n o w n r e v i s i o n o r p a t h n o t i n t h e w o r k i n g t r e e /
3839] ;
3940
4041interface GitCommandOptions {
@@ -436,10 +437,19 @@ export class Git {
436437 return data ;
437438 }
438439 catch ( ex ) {
439- if ( / H E A D d o e s n o t p o i n t t o a b r a n c h / . test ( ex && ex . toString ( ) ) ) return undefined ;
440-
441- if ( / n o u p s t r e a m c o n f i g u r e d f o r b r a n c h / . test ( ex && ex . toString ( ) ) ) {
442- return ex . message . split ( '\n' ) [ 0 ] ;
440+ const msg = ex && ex . toString ( ) ;
441+ if ( / H E A D d o e s n o t p o i n t t o a b r a n c h / . test ( msg ) ) return undefined ;
442+ if ( / n o u p s t r e a m c o n f i g u r e d f o r b r a n c h / . test ( msg ) ) return ex . message . split ( '\n' ) [ 0 ] ;
443+
444+ if ( / a m b i g u o u s a r g u m e n t ' .* ?' : u n k n o w n r e v i s i o n o r p a t h n o t i n t h e w o r k i n g t r e e / . test ( msg ) ) {
445+ try {
446+ const params = [ `symbolic-ref` , `-q` , `--short` , `HEAD` ] ;
447+ const data = await gitCommand ( opts , ...params ) ;
448+ return data ;
449+ }
450+ catch {
451+ return undefined ;
452+ }
443453 }
444454
445455 return gitCommandDefaultErrorHandler ( ex , opts , ...params ) ;
0 commit comments