@@ -26,6 +26,7 @@ import { GoodCommand, namesOfRebaseCommandsThatMakeRebaseExitToPause } from "./p
2626
2727export type OptionsForGitStackedRebase = {
2828 gitDir : string ;
29+ getGitConfig : ( ctx : { GitConfig : typeof Git . Config ; repo : Git . Repository } ) => Promise < Git . Config > | Git . Config ;
2930
3031 /**
3132 * editor name, or a function that opens the file inside some editor.
@@ -49,10 +50,15 @@ export type OptionsForGitStackedRebase = {
4950
5051export type SomeOptionsForGitStackedRebase = Partial < OptionsForGitStackedRebase > ;
5152
52- const getDefaultOptions = ( ) : OptionsForGitStackedRebase => ( {
53+ export const defaultEditor = "vi" as const ;
54+ export const defaultGitCmd = "/usr/bin/env git" as const ;
55+
56+ export const getDefaultOptions = ( ) : OptionsForGitStackedRebase => ( {
5357 gitDir : "." , //
54- editor : process . env . EDITOR ?? "vi" ,
55- gitCmd : process . env . GIT_CMD ?? "/usr/bin/env git" ,
58+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
59+ getGitConfig : ( { GitConfig } ) => GitConfig . openDefault ( ) ,
60+ editor : process . env . EDITOR ?? defaultEditor ,
61+ gitCmd : process . env . GIT_CMD ?? defaultGitCmd ,
5662 viewTodoOnly : false ,
5763 apply : false ,
5864 push : false ,
@@ -107,7 +113,7 @@ export const gitStackedRebase = async (
107113 }
108114
109115 const repo = await Git . Repository . open ( options . gitDir ) ;
110- const config = await Git . Config . openDefault ( ) ;
116+ const config : Git . Config = await options . getGitConfig ( { GitConfig : Git . Config , repo } ) ;
111117
112118 const configValues = {
113119 gpgSign : ! ! ( await config . getBool ( configKeys . gpgSign ) . catch ( ( ) => 0 ) ) ,
0 commit comments