8000 fix: unshallow repository with credentials · semantic-release/semantic-release@45d7e6f · GitHub
[go: up one dir, main page]

Skip to content

Commit 45d7e6f

Browse files
botcheddevilpvdlg
authored andcommitted
fix: unshallow repository with credentials
1 parent c02b5ca commit 45d7e6f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async function run(options, plugins) {
5757
await plugins.verifyConditions({options, logger}, {settleAll: true});
5858

5959
// Unshallow the repo in order to get all the tags
60-
await unshallow();
60+
await unshallow(options.repositoryUrl);
6161

6262
const lastRelease = await getLastRelease(options.tagFormat, logger);
6363
const commits = await getCommits(lastRelease.gitHead, options.branch, logger);

lib/git.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ async function isRefInHistory(ref) {
4444

4545
/**
4646
* Unshallow the git repository (retriving every commits and tags).
47+
*
48+
* @param {String} repositoryUrl The remote repository URL with credentials.
4749
*/
48-
async function unshallow() {
49-
await execa('git', ['fetch', '--unshallow', '--tags'], {reject: false});
50+
async function unshallow(repositoryUrl) {
51+
await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], {reject: false});
5052
}
5153

5254
/**

test/git.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ test.serial('Unshallow repository', async t => {
6161
// Verify the shallow clone contains only one commit
6262
t.is((await gitGetCommits()).length, 1);
6363

64-
await unshallow();
64+
await unshallow(repo);
6565

6666
// Verify the shallow clone contains all the commits
6767
t.is((await gitGetCommits()).length, 2);
6868
});
6969

7070
test.serial('Do not throw error when unshallow a complete repository', async t => {
7171
// Create a git repository, set the current working directory at the root of the repo
72-
await gitRepo();
72+
const repo = await gitRepo();
7373
// Add commits to the master branch
7474
await gitCommits(['First']);
75-
await t.notThrows(unshallow());
75+
await t.notThrows(unshallow(repo));
7676
});
7777

7878
test.serial('Verify if the commit `sha` is in the direct history of the current branch', async t => {

0 commit comments

Comments
 (0)
0