File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,12 @@ before(function() {
8787 return fse . writeFile ( local ( "home" , ".gitconfig" ) ,
8888 "[user]\n name = John Doe\n email = johndoe@example.com" ) ;
8989 } )
90- . then ( async function ( ) {
91- //mark all test repos as safe
92- for ( let repo of testRepos ) {
93- await exec ( `git config --global --add safe.directory ${ local ( repo ) } ` ) ;
90+ . then ( async function ( ) {
91+ // mark test repos as safe if not already marked
92+ const currentSafeDirectories = new Set ( ( await exec ( "git config --global --get-all safe.directory" ) ) . trim ( ) . split ( "\n" ) ) ;
93+ const directoriesToMarkAsSafe = testRepos . filter ( testRepo => ! currentSafeDirectories . has ( testRepo ) ) ;
94+ for ( const directory of directoriesToMarkAsSafe ) {
95+ await exec ( `git config --global --add safe.directory ${ local ( directory ) } ` ) ;
9496 }
9597 } )
9698} ) ;
You can’t perform that action at this time.
0 commit comments