@@ -13,7 +13,7 @@ const exec = util.promisify(childProcess.exec);
13
13
/**
14
14
* Run a `git` subcommand with options and return output.
15
15
*/
16
- function _execute ( cwd : string , subcommand : string , options : string [ ] = [ ] ) {
16
+ export function execute ( cwd : string , subcommand : string , options : string [ ] = [ ] ) {
17
17
const command = `git ${ subcommand } ${ options . join ( " " ) } ` ;
18
18
19
19
const result = exec ( command , { cwd } ) ;
@@ -44,8 +44,10 @@ async function _diffIndex(options: string[] = []): Promise<Array<string>> {
44
44
...options ,
45
45
"HEAD" ,
46
46
] ;
47
- const { stdout, stderr } = await _execute (
48
- getWorkspaceFolder ( ) ,
47
+
48
+ const workspace = getWorkspaceFolder ( )
49
+ const { stdout, stderr } = await execute (
50
+ workspace ,
49
51
cmd ,
50
52
fullOptions
51
53
) ;
@@ -88,36 +90,3 @@ export async function getChanges() {
88
90
}
89
91
return allChanges ;
90
92
}
91
-
92
-
93
- /**
94
- * Get a value from the Git config.
95
- *
96
- * The CLI will assume local (project) project by default.
97
- */
98
- export async function _getConfigValue ( options : string [ ] ) {
99
- const cmd = "config"
100
-
101
- const { stdout, stderr } = await _execute (
102
- getWorkspaceFolder ( ) ,
103
- cmd ,
104
- options
105
- ) ;
106
-
107
- if ( stderr ) {
108
- console . debug ( `stderr for 'git ${ cmd } ' command:` , stderr ) ;
109
- }
110
-
111
- return stdout
112
- }
113
-
114
- /**
115
- * Get the configured value for a commit template path if set, or empty string.
116
- */
117
- export async function getCommitTemplateName ( ) {
118
- try {
119
- return await _getConfigValue ( [ 'commit.template' ] )
120
- } catch ( _e ) {
121
- return ""
122
- }
123
- }
0 commit comments