@@ -74,39 +74,38 @@ const textDecoder = new TextDecoder('utf8');
7474const rootSha = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' ;
7575
7676export const GitErrors = {
77+ alreadyCheckedOut : / a l r e a d y c h e c k e d o u t / i,
78+ alreadyExists : / a l r e a d y e x i s t s / i,
79+ ambiguousArgument : / f a t a l : \s * 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 / i,
7780 badRevision : / b a d r e v i s i o n ' ( .* ?) ' / i,
7881 cantLockRef : / c a n n o t l o c k r e f | u n a b l e t o u p d a t e l o c a l r e f / i,
7982 changesWouldBeOverwritten : / Y o u r l o c a l c h a n g e s t o t h e f o l l o w i n g f i l e s w o u l d b e o v e r w r i t t e n / i,
8083 commitChangesFirst : / P l e a s e , c o m m i t y o u r c h a n g e s b e f o r e y o u c a n / i,
8184 conflict : / ^ C O N F L I C T \( [ ^ ) ] + \) : \b / m,
85+ entryNotUpToDate : / e r r o r : \s * E n t r y [ ' " ] .+ [ ' " ] n o t u p t o d a t e \. C a n n o t m e r g e \. / i,
8286 failedToDeleteDirectoryNotEmpty : / f a i l e d t o d e l e t e ' ( .* ?) ' : D i r e c t o r y n o t e m p t y / i,
87+ invalidLineCount : / f i l e .+ ? h a s o n l y \d + l i n e s / i,
8388 invalidObjectName : / i n v a l i d o b j e c t n a m e : ( .* ) \s / i,
8489 invalidObjectNameList : / c o u l d n o t o p e n o b j e c t n a m e l i s t : ( .* ) \s / i,
90+ mainWorkingTree : / i s a m a i n w o r k i n g t r e e / i,
8591 noFastForward : / \( n o n - f a s t - f o r w a r d \) / i,
8692 noMergeBase : / n o m e r g e b a s e / i,
8793 noRemoteRepositorySpecified : / N o r e m o t e r e p o s i t o r y s p e c i f i e d \. / i,
94+ noUpstream : / ^ f a t a l : T h e c u r r e n t b r a n c h .* h a s n o u p s t r e a m b r a n c h / i,
95+ noUserNameConfigured : / P l e a s e t e l l m e w h o y o u a r e \. / i,
8896 notAValidObjectName : / N o t a v a l i d o b j e c t n a m e / i,
8997 notAWorkingTree : / ' ( .* ?) ' i s n o t a w o r k i n g t r e e / i,
90- noUserNameConfigured : / P l e a s e t e l l m e w h o y o u a r e \. / i,
91- invalidLineCount : / f i l e .+ ? h a s o n l y \d + l i n e s / i,
92- uncommittedChanges : / c o n t a i n s m o d i f i e d o r u n t r a c k e d f i l e s / i,
93- alreadyExists : / a l r e a d y e x i s t s / i,
94- alreadyCheckedOut : / a l r e a d y c h e c k e d o u t / i,
95- mainWorkingTree : / i s a m a i n w o r k i n g t r e e / i,
96- noUpstream : / ^ f a t a l : T h e c u r r e n t b r a n c h .* h a s n o u p s t r e a m b r a n c h / i,
9798 permissionDenied : / P e r m i s s i o n .* d e n i e d / i,
9899 pushRejected : / ^ e r r o r : f a i l e d t o p u s h s o m e r e f s t o \b / m,
99100 rebaseMultipleBranches : / c a n n o t r e b a s e o n t o m u l t i p l e b r a n c h e s / i,
101+ refLocked : / f a t a l : \s * c a n n o t l o c k r e f [ ' " ] .+ [ ' " ] : u n a b l e t o c r e a t e f i l e / i,
100102 remoteAhead : / r e j e c t e d b e c a u s e t h e r e m o t e c o n t a i n s w o r k / i,
101103 remoteConnection : / C o u l d n o t r e a d f r o m r e m o t e r e p o s i t o r y / i,
102104 tagConflict : / ! \[ r e j e c t e d \] .* \( w o u l d c l o b b e r e x i s t i n g t a g \) / m,
105+ uncommittedChanges : / c o n t a i n s m o d i f i e d o r u n t r a c k e d f i l e s / i,
106+ unmergedChanges : / e r r o r : \s * y o u n e e d t o r e s o l v e y o u r c u r r e n t i n d e x f i r s t / i,
103107 unmergedFiles : / i s n o t p o s s i b l e b e c a u s e y o u h a v e u n m e r g e d f i l e s / i,
104108 unstagedChanges : / Y o u h a v e u n s t a g e d c h a n g e s / i,
105- unmergedChanges : / e r r o r : \s * y o u n e e d t o r e s o l v e y o u r c u r r e n t i n d e x f i r s t / i,
106- ambiguousArgument : / f a t a l : \s * 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 / i,
107- entryNotUpToDate : / e r r o r : \s * E n t r y [ ' " ] .+ [ ' " ] n o t u p t o d a t e \. C a n n o t m e r g e \. / i,
108- changesWouldBeOverwritten : / e r r o r : \s * Y o u r l o c a l c h a n g e s t o t h e f o l l o w i n g f i l e s w o u l d b e o v e r w r i t t e n / i,
109- refLocked : / f a t a l : \s * c a n n o t l o c k r e f [ ' " ] .+ [ ' " ] : u n a b l e t o c r e a t e f i l e / i,
110109} ;
111110
112111const GitWarnings = {
@@ -167,12 +166,12 @@ function getStdinUniqueKey(): number {
167166type ExitCodeOnlyGitCommandOptions = GitCommandOptions & { exitCodeOnly : true } ;
168167export type PushForceOptions = { withLease : true ; ifIncludes ?: boolean } | { withLease : false ; ifIncludes ?: never } ;
169168
170- const resetErrorAndReason = [
171- [ unmergedChanges , ResetErrorReason . UnmergedChanges ] ,
172- [ ambiguousArgument , ResetErrorReason . AmbiguousArgument ] ,
173- [ entryNotUpToDate , ResetErrorReason . EntryNotUpToDate ] ,
174- [ changesWouldBeOverwritten , ResetErrorReason . LocalChangesWouldBeOverwritten ] ,
175- [ refLocked , ResetErrorReason . RefLocked ] ,
169+ const resetErrorAndReason : [ RegExp , ResetErrorReason ] [ ] = [
170+ [ GitErrors . unmergedChanges , ResetErrorReason . UnmergedChanges ] ,
171+ [ GitErrors . ambiguousArgument , ResetErrorReason . AmbiguousArgument ] ,
172+ [ GitErrors . entryNotUpToDate , ResetErrorReason . EntryNotUpToDate ] ,
173+ [ GitErrors . changesWouldBeOverwritten , ResetErrorReason . LocalChangesWouldBeOverwritten ] ,
174+ [ GitErrors . refLocked , ResetErrorReason . RefLocked ] ,
176175] ;
177176
178177export class Git {
@@ -1586,9 +1585,9 @@ export class Git {
15861585 return this . git < string > ( { cwd : repoPath } , 'remote' , 'get-url' , remote ) ;
15871586 }
15881587
1589- reset ( repoPath : string , pathspecs : string [ ] , ...args : string [ ] ) {
1588+ async reset ( repoPath : string , pathspecs : string [ ] , ...args : string [ ] ) {
15901589 try {
1591- return this . git < string > ( { cwd : repoPath } , 'reset' , '-q' , ...args , '--' , ...pathspecs ) ;
1590+ await this . git < string > ( { cwd : repoPath } , 'reset' , '-q' , ...args , '--' , ...pathspecs ) ;
15921591 } catch ( ex ) {
15931592 const msg : string = ex ?. toString ( ) ?? '' ;
15941593 for ( const [ error , reason ] of resetErrorAndReason ) {
0 commit comments