11import { ChildProcess } from "child_process" ;
2- import { GitProcess , IGitExecutionOptions } from "dugite" ;
2+ import { exec as GitProcess } from "dugite" ;
33
44// For convenience, let's add helpers to call Git:
55
@@ -119,7 +119,7 @@ export function git(args: string[], options?: IGitOptions): Promise<string> {
119119 } ;
120120 }
121121
122- GitProcess . exec ( args , workDir , options as IGitExecutionOptions )
122+ GitProcess ( args , workDir , options )
123123 . then ( ( result ) => {
124124 if ( result . exitCode ) {
125125 reject ( new Error ( `git ${ args . join ( " " ) } failed: ${ result . exitCode } ,\n${ result . stderr } ` ) ) ;
@@ -158,7 +158,7 @@ export function git(args: string[], options?: IGitOptions): Promise<string> {
158158 * @returns { string | undefined } the full SHA-1, or undefined
159159 */
160160export async function revParse ( argument : string , workDir ?: string ) : Promise < string | undefined > {
161- const result = await GitProcess . exec ( [ "rev-parse" , "--verify" , "-q" , argument ] , workDir || "." ) ;
161+ const result = await GitProcess ( [ "rev-parse" , "--verify" , "-q" , argument ] , workDir || "." ) ;
162162 return result . exitCode ? undefined : trimTrailingNewline ( result . stdout ) ;
163163}
164164
@@ -177,7 +177,7 @@ export async function revListCount(rangeArgs: string | string[], workDir = "."):
177177 } else {
178178 gitArgs . push ( ...rangeArgs ) ;
179179 }
180- const result = await GitProcess . exec ( gitArgs , workDir ) ;
180+ const result = await GitProcess ( gitArgs , workDir ) ;
181181 if ( result . exitCode ) {
182182 throw new Error ( `Could not determine count for ${ rangeArgs } : ${ result . stderr } ` ) ;
183183 }
@@ -196,7 +196,7 @@ export async function commitExists(commit: string, workDir: string): Promise<boo
196196}
197197
198198export async function gitConfig ( key : string , workDir ?: string ) : Promise < string | undefined > {
199- const result = await GitProcess . exec ( [ "config" , key ] , workDir || "." ) ;
199+ const result = await GitProcess ( [ "config" , key ] , workDir || "." ) ;
200200 if ( result . exitCode !== 0 ) {
201201 return undefined ;
202202 }
@@ -208,12 +208,12 @@ export async function gitConfigForEach(
208208 callbackfn : ( value : string ) => void ,
209209 workDir ?: string ,
210210) : Promise < void > {
211- const result = await GitProcess . exec ( [ "config" , "--get-all" , key ] , workDir || "." ) ;
211+ const result = await GitProcess ( [ "config" , "--get-all" , key ] , workDir || "." ) ;
212212 result . stdout . split ( / \r ? \n / ) . map ( callbackfn ) ;
213213}
214214
215215export async function gitCommandExists ( command : string , workDir ?: string ) : Promise < boolean > {
216- const result = await GitProcess . exec ( [ command , "-h" ] , workDir || "." ) ;
216+ const result = await GitProcess ( [ command , "-h" ] , workDir || "." ) ;
217217 return result . exitCode === 129 ;
218218}
219219
0 commit comments