mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 01:13:36 +00:00 
			
		
		
		
	Add mock implementation for new function submoduleStatus
This commit is contained in:
		
							parent
							
								
									39cfb844ff
								
							
						
					
					
						commit
						d12863bffd
					
				@ -770,6 +770,9 @@ async function setup(testName: string): Promise<void> {
 | 
				
			|||||||
      return ''
 | 
					      return ''
 | 
				
			||||||
    }),
 | 
					    }),
 | 
				
			||||||
    submoduleSync: jest.fn(),
 | 
					    submoduleSync: jest.fn(),
 | 
				
			||||||
 | 
					    submoduleStatus: jest.fn(async () => {
 | 
				
			||||||
 | 
					      return true
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
    submoduleUpdate: jest.fn(),
 | 
					    submoduleUpdate: jest.fn(),
 | 
				
			||||||
    tagExists: jest.fn(),
 | 
					    tagExists: jest.fn(),
 | 
				
			||||||
    tryClean: jest.fn(),
 | 
					    tryClean: jest.fn(),
 | 
				
			||||||
 | 
				
			|||||||
@ -423,6 +423,9 @@ async function setup(testName: string): Promise<void> {
 | 
				
			|||||||
    submoduleForeach: jest.fn(),
 | 
					    submoduleForeach: jest.fn(),
 | 
				
			||||||
    submoduleSync: jest.fn(),
 | 
					    submoduleSync: jest.fn(),
 | 
				
			||||||
    submoduleUpdate: jest.fn(),
 | 
					    submoduleUpdate: jest.fn(),
 | 
				
			||||||
 | 
					    submoduleStatus: jest.fn(async () => {
 | 
				
			||||||
 | 
					      return true
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
    tagExists: jest.fn(),
 | 
					    tagExists: jest.fn(),
 | 
				
			||||||
    tryClean: jest.fn(async () => {
 | 
					    tryClean: jest.fn(async () => {
 | 
				
			||||||
      return true
 | 
					      return true
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@ -7686,6 +7686,7 @@ class GitCommandManager {
 | 
				
			|||||||
    submoduleStatus() {
 | 
					    submoduleStatus() {
 | 
				
			||||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
					        return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
            const output = yield this.execGit(['submodule', 'status'], true);
 | 
					            const output = yield this.execGit(['submodule', 'status'], true);
 | 
				
			||||||
 | 
					            core.debug(output.stdout);
 | 
				
			||||||
            return output.exitCode === 0;
 | 
					            return output.exitCode === 0;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -9445,6 +9446,7 @@ function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref
 | 
				
			|||||||
                // Check for submodules and delete any existing files if submodules are present
 | 
					                // Check for submodules and delete any existing files if submodules are present
 | 
				
			||||||
                if (!(yield git.submoduleStatus())) {
 | 
					                if (!(yield git.submoduleStatus())) {
 | 
				
			||||||
                    remove = true;
 | 
					                    remove = true;
 | 
				
			||||||
 | 
					                    core.info('Bad Submodules found, removing existing files');
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                // Clean
 | 
					                // Clean
 | 
				
			||||||
                if (clean) {
 | 
					                if (clean) {
 | 
				
			||||||
 | 
				
			|||||||
@ -360,6 +360,7 @@ class GitCommandManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  async submoduleStatus(): Promise<boolean> {
 | 
					  async submoduleStatus(): Promise<boolean> {
 | 
				
			||||||
    const output = await this.execGit(['submodule', 'status'], true)
 | 
					    const output = await this.execGit(['submodule', 'status'], true)
 | 
				
			||||||
 | 
					    core.debug(output.stdout)
 | 
				
			||||||
    return output.exitCode === 0
 | 
					    return output.exitCode === 0
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -84,6 +84,7 @@ export async function prepareExistingDirectory(
 | 
				
			|||||||
      // Check for submodules and delete any existing files if submodules are present
 | 
					      // Check for submodules and delete any existing files if submodules are present
 | 
				
			||||||
      if (!(await git.submoduleStatus())) {
 | 
					      if (!(await git.submoduleStatus())) {
 | 
				
			||||||
        remove = true
 | 
					        remove = true
 | 
				
			||||||
 | 
					        core.info('Bad Submodules found, removing existing files')
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Clean
 | 
					      // Clean
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user