fix: unshallow repository with credentials
This commit is contained in:
		
							parent
							
								
									c02b5cac6b
								
							
						
					
					
						commit
						45d7e6f25f
					
				
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								index.js
									
									
									
									
									
								
							| @ -57,7 +57,7 @@ async function run(options, plugins) { | |||||||
|   await plugins.verifyConditions({options, logger}, {settleAll: true}); |   await plugins.verifyConditions({options, logger}, {settleAll: true}); | ||||||
| 
 | 
 | ||||||
|   // Unshallow the repo in order to get all the tags
 |   // Unshallow the repo in order to get all the tags
 | ||||||
|   await unshallow(); |   await unshallow(options.repositoryUrl); | ||||||
| 
 | 
 | ||||||
|   const lastRelease = await getLastRelease(options.tagFormat, logger); |   const lastRelease = await getLastRelease(options.tagFormat, logger); | ||||||
|   const commits = await getCommits(lastRelease.gitHead, options.branch, logger); |   const commits = await getCommits(lastRelease.gitHead, options.branch, logger); | ||||||
|  | |||||||
| @ -44,9 +44,11 @@ async function isRefInHistory(ref) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Unshallow the git repository (retriving every commits and tags). |  * Unshallow the git repository (retriving every commits and tags). | ||||||
|  |  * | ||||||
|  |  * @param {String} repositoryUrl The remote repository URL with credentials. | ||||||
|  */ |  */ | ||||||
| async function unshallow() { | async function unshallow(repositoryUrl) { | ||||||
|   await execa('git', ['fetch', '--unshallow', '--tags'], {reject: false}); |   await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], {reject: false}); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | |||||||
| @ -61,7 +61,7 @@ test.serial('Unshallow repository', async t => { | |||||||
|   // Verify the shallow clone contains only one commit
 |   // Verify the shallow clone contains only one commit
 | ||||||
|   t.is((await gitGetCommits()).length, 1); |   t.is((await gitGetCommits()).length, 1); | ||||||
| 
 | 
 | ||||||
|   await unshallow(); |   await unshallow(repo); | ||||||
| 
 | 
 | ||||||
|   // Verify the shallow clone contains all the commits
 |   // Verify the shallow clone contains all the commits
 | ||||||
|   t.is((await gitGetCommits()).length, 2); |   t.is((await gitGetCommits()).length, 2); | ||||||
| @ -69,10 +69,10 @@ test.serial('Unshallow repository', async t => { | |||||||
| 
 | 
 | ||||||
| test.serial('Do not throw error when unshallow a complete repository', async t => { | test.serial('Do not throw error when unshallow a complete repository', async t => { | ||||||
|   // Create a git repository, set the current working directory at the root of the repo
 |   // Create a git repository, set the current working directory at the root of the repo
 | ||||||
|   await gitRepo(); |   const repo = await gitRepo(); | ||||||
|   // Add commits to the master branch
 |   // Add commits to the master branch
 | ||||||
|   await gitCommits(['First']); |   await gitCommits(['First']); | ||||||
|   await t.notThrows(unshallow()); |   await t.notThrows(unshallow(repo)); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test.serial('Verify if the commit `sha` is in the direct history of the current branch', async t => { | test.serial('Verify if the commit `sha` is in the direct history of the current branch', async t => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user