@@ -11,6 +11,7 @@ import {
1111 removeSSHConfig ,
1212 addSSHConfig ,
1313} from './ssh' ;
14+ import { record } from '../recorder' ;
1415
1516const USER_GIT_CONFIG_FILENAME_PREFIX = '.gitconfig-' ;
1617const IGNORE_CONFIG_KEYS = [ 'gitDir' ] ;
@@ -24,6 +25,10 @@ export async function getGlobalGitConfig() {
2425export async function updateGlobalGitConfig ( gitConfig : object ) {
2526 log . info ( 'update-global-git-config' , gitConfig ) ;
2627 await writeGitConfig ( GLOBAL_GITCONFIG_PATH , gitConfig ) ;
28+ record ( {
29+ module : 'git' ,
30+ action : 'updateGlobalGitConfig' ,
31+ } ) ;
2732}
2833
2934export async function getExistedUserGitConfigNames ( ) {
@@ -70,6 +75,10 @@ export async function addUserGitConfig(userGitConfig: IAddUserConfig) {
7075 delete userGitConfig . configName ;
7176 await writeGitConfig ( gitConfigPath , userGitConfig ) ;
7277 await addSSHConfig ( { hostName, configName, userName } ) ;
78+ record ( {
79+ module : 'git' ,
80+ action : 'addUserGitConfig' ,
81+ } ) ;
7382}
7483
7584export async function updateUserGitConfig ( gitConfig : any , configName : string ) {
@@ -85,6 +94,10 @@ export async function updateUserGitConfig(gitConfig: any, configName: string) {
8594 await writeGitConfig ( gitConfigPath , gitConfig ) ;
8695
8796 log . info ( 'update-user-git-config' , configName , gitConfig ) ;
97+ record ( {
98+ module : 'git' ,
99+ action : 'updateUserGitConfig' ,
100+ } ) ;
88101}
89102
90103async function getUserGitDirs ( ) {
@@ -125,6 +138,10 @@ export async function updateUserGitDir(
125138 await writeGitConfig ( GLOBAL_GITCONFIG_PATH , globalGitConfig ) ;
126139
127140 log . info ( 'update-user-git-dir: ' , currentIncludeIfKey , globalGitConfig [ currentIncludeIfKey ] ) ;
141+ record ( {
142+ module : 'git' ,
143+ action : 'updateUserGitDir' ,
144+ } ) ;
128145}
129146
130147export async function removeUserGitDir ( gitDir : string , configName : string ) {
@@ -137,6 +154,10 @@ export async function removeUserGitDir(gitDir: string, configName: string) {
137154 delete globalGitConfig [ includeIfKey ] ;
138155 await writeGitConfig ( GLOBAL_GITCONFIG_PATH , globalGitConfig ) ;
139156 log . info ( 'remove-user-git-dir: ' , includeIfKey , gitConfigPath ) ;
157+ record ( {
158+ module : 'git' ,
159+ action : 'removeUserGitDir' ,
160+ } ) ;
140161 } else {
141162 const error = new Error ( `Can not remove ${ gitDir } . The ${ includeIfValue } is not found.` ) ;
142163 log . error ( error ) ;
@@ -154,6 +175,11 @@ export async function removeUserGitConfig(configName: string, gitDirs = []) {
154175 // remove the gitconfig file
155176 const gitConfigPath = getGitConfigPath ( configName ) ;
156177 await fse . remove ( gitConfigPath ) ;
178+
179+ record ( {
180+ module : 'git' ,
181+ action : 'removeUserGitConfig' ,
182+ } ) ;
157183}
158184
159185async function parseGitConfig ( gitConfigPath : string ) {
0 commit comments