mirror of
				https://code.forgejo.org/actions/checkout.git
				synced 2025-11-04 06:39:11 +00:00 
			
		
		
		
	Merge 1bf7689f6b into 8edcb1bdb4
				
					
				
			This commit is contained in:
		
						commit
						90d3e38706
					
				
					 3 changed files with 18 additions and 10 deletions
				
			
		| 
						 | 
					@ -482,6 +482,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      settings.persistCredentials = false
 | 
					      settings.persistCredentials = false
 | 
				
			||||||
      settings.sshKey = ''
 | 
					      settings.sshKey = ''
 | 
				
			||||||
 | 
					      settings.submodules = true
 | 
				
			||||||
      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
					      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
				
			||||||
      await authHelper.configureAuth()
 | 
					      await authHelper.configureAuth()
 | 
				
			||||||
      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
					      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
				
			||||||
| 
						 | 
					@ -515,6 +516,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			||||||
        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsFalseAndSshKeySet
 | 
					        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsFalseAndSshKeySet
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      settings.persistCredentials = false
 | 
					      settings.persistCredentials = false
 | 
				
			||||||
 | 
					      settings.submodules = true
 | 
				
			||||||
      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
					      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
				
			||||||
      await authHelper.configureAuth()
 | 
					      await authHelper.configureAuth()
 | 
				
			||||||
      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
					      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
				
			||||||
| 
						 | 
					@ -541,6 +543,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			||||||
        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeyNotSet
 | 
					        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeyNotSet
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      settings.sshKey = ''
 | 
					      settings.sshKey = ''
 | 
				
			||||||
 | 
					      settings.submodules = true
 | 
				
			||||||
      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
					      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
				
			||||||
      await authHelper.configureAuth()
 | 
					      await authHelper.configureAuth()
 | 
				
			||||||
      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
					      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
				
			||||||
| 
						 | 
					@ -580,6 +583,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			||||||
      await setup(
 | 
					      await setup(
 | 
				
			||||||
        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeySet
 | 
					        configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeySet
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
 | 
					      settings.submodules = true
 | 
				
			||||||
      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
					      const authHelper = gitAuthHelper.createAuthHelper(git, settings)
 | 
				
			||||||
      await authHelper.configureAuth()
 | 
					      await authHelper.configureAuth()
 | 
				
			||||||
      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
					      const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -424,10 +424,12 @@ class GitAuthHelper {
 | 
				
			||||||
                    core.warning(`Failed to remove '${configKey}' from the git config`);
 | 
					                    core.warning(`Failed to remove '${configKey}' from the git config`);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            const pattern = regexpHelper.escape(configKey);
 | 
					            if (this.settings.submodules) {
 | 
				
			||||||
            yield this.git.submoduleForeach(
 | 
					                const pattern = regexpHelper.escape(configKey);
 | 
				
			||||||
            // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
 | 
					                yield this.git.submoduleForeach(
 | 
				
			||||||
            `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
 | 
					                // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
 | 
				
			||||||
 | 
					                `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -364,11 +364,13 @@ class GitAuthHelper {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const pattern = regexpHelper.escape(configKey)
 | 
					    if (this.settings.submodules) {
 | 
				
			||||||
    await this.git.submoduleForeach(
 | 
					      const pattern = regexpHelper.escape(configKey)
 | 
				
			||||||
      // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
 | 
					      await this.git.submoduleForeach(
 | 
				
			||||||
      `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
 | 
					        // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
 | 
				
			||||||
      true
 | 
					        `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
 | 
				
			||||||
    )
 | 
					        true
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue