mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 18:18:37 +08:00 
			
		
		
		
	fix issue checking detached when git less than 2.22
This commit is contained in:
		
							parent
							
								
									c85684db76
								
							
						
					
					
						commit
						44e1b123fc
					
				
							
								
								
									
										8
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -4887,11 +4887,9 @@ class GitCommandManager { | ||||||
|     } |     } | ||||||
|     isDetached() { |     isDetached() { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|             // Note, this implementation uses "branch --show-current" because
 |             // Note, "branch --show-current" would be simpler but isn't available until Git 2.22
 | ||||||
|             // "rev-parse --symbolic-full-name HEAD" can fail on a new repo
 |             const output = yield this.execGit(['rev-parse', '--symbolic-full-nane', 'HEAD'], true); | ||||||
|             // with nothing checked out.
 |             return !output.stdout.trim().startsWith('refs/heads/'); | ||||||
|             const output = yield this.execGit(['branch', '--show-current']); |  | ||||||
|             return output.stdout.trim() === ''; |  | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     lfsFetch(ref) { |     lfsFetch(ref) { | ||||||
|  |  | ||||||
|  | @ -170,12 +170,12 @@ class GitCommandManager { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async isDetached(): Promise<boolean> { |   async isDetached(): Promise<boolean> { | ||||||
|     // Note, this implementation uses "branch --show-current" because
 |     // Note, "branch --show-current" would be simpler but isn't available until Git 2.22
 | ||||||
|     // "rev-parse --symbolic-full-name HEAD" can fail on a new repo
 |     const output = await this.execGit( | ||||||
|     // with nothing checked out.
 |       ['rev-parse', '--symbolic-full-nane', 'HEAD'], | ||||||
| 
 |       true | ||||||
|     const output = await this.execGit(['branch', '--show-current']) |     ) | ||||||
|     return output.stdout.trim() === '' |     return !output.stdout.trim().startsWith('refs/heads/') | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async lfsFetch(ref: string): Promise<void> { |   async lfsFetch(ref: string): Promise<void> { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 eric sciple
						eric sciple