@@ -22,7 +22,8 @@ export type Commit = {
22
22
}
23
23
24
24
export type ExecOpts = {
25
- allowAllExitCodes ?: boolean ,
25
+ allowAllExitCodes ?: boolean
26
+ encoding ?: 'utf8' | 'base64'
26
27
}
27
28
28
29
export class GitCommandManager {
@@ -282,9 +283,9 @@ export class GitCommandManager {
282
283
return output . stdout . trim ( )
283
284
}
284
285
285
- async showFileAtRef ( ref : string , path : string ) : Promise < string > {
286
+ async showFileAtRefBase64 ( ref : string , path : string ) : Promise < string > {
286
287
const args = [ 'show' , `${ ref } :${ path } ` ]
287
- const output = await this . exec ( args )
288
+ const output = await this . exec ( args , { encoding : 'base64' } )
288
289
return output . stdout . trim ( )
289
290
}
290
291
@@ -376,10 +377,10 @@ export class GitCommandManager {
376
377
ignoreReturnCode : opts . allowAllExitCodes ?? false ,
377
378
listeners : {
378
379
stdout : ( data : Buffer ) => {
379
- stdout . push ( data . toString ( ) )
380
+ stdout . push ( data . toString ( opts . encoding ?? 'utf8' ) )
380
381
} ,
381
382
stderr : ( data : Buffer ) => {
382
- stderr . push ( data . toString ( ) )
383
+ stderr . push ( data . toString ( opts . encoding ?? 'utf8' ) )
383
384
}
384
385
}
385
386
}
0 commit comments