mirror of
https://github.com/actions/checkout.git
synced 2024-12-22 18:55:35 +00:00
.
This commit is contained in:
parent
036772999d
commit
605b7eb961
12
dist/index.js
vendored
12
dist/index.js
vendored
|
@ -5846,13 +5846,17 @@ function getSource(settings) {
|
||||||
stateHelper.setRepositoryPath(settings.repositoryPath);
|
stateHelper.setRepositoryPath(settings.repositoryPath);
|
||||||
// Initialize the repository
|
// Initialize the repository
|
||||||
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
||||||
|
core.startGroup('Initializing the repository');
|
||||||
yield git.init();
|
yield git.init();
|
||||||
yield git.remoteAdd('origin', initialRemoteUrl);
|
yield git.remoteAdd('origin', initialRemoteUrl);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
// Disable automatic garbage collection
|
// Disable automatic garbage collection
|
||||||
|
core.startGroup('Disabling automatic garbage collection');
|
||||||
if (!(yield git.tryDisableAutomaticGarbageCollection())) {
|
if (!(yield git.tryDisableAutomaticGarbageCollection())) {
|
||||||
core.warning(`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`);
|
core.warning(`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`);
|
||||||
}
|
}
|
||||||
|
core.endGroup();
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings);
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings);
|
||||||
try {
|
try {
|
||||||
// Configure auth
|
// Configure auth
|
||||||
|
@ -5869,7 +5873,9 @@ function getSource(settings) {
|
||||||
yield git.fetch(settings.fetchDepth, refSpec);
|
yield git.fetch(settings.fetchDepth, refSpec);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Checkout info
|
// Checkout info
|
||||||
|
core.startGroup('Determining the checkout info');
|
||||||
const checkoutInfo = yield refHelper.getCheckoutInfo(git, settings.ref, settings.commit);
|
const checkoutInfo = yield refHelper.getCheckoutInfo(git, settings.ref, settings.commit);
|
||||||
|
core.endGroup();
|
||||||
// LFS fetch
|
// LFS fetch
|
||||||
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
||||||
// Explicit lfs fetch will fetch lfs objects in parallel.
|
// Explicit lfs fetch will fetch lfs objects in parallel.
|
||||||
|
@ -5880,10 +5886,14 @@ function getSource(settings) {
|
||||||
}
|
}
|
||||||
// Fix URL when using SSH
|
// Fix URL when using SSH
|
||||||
if (settings.sshKey && initialRemoteUrl !== sshUrl) {
|
if (settings.sshKey && initialRemoteUrl !== sshUrl) {
|
||||||
|
core.startGroup('Updating the repository to use the SSH URL');
|
||||||
yield git.setRemoteUrl(sshUrl);
|
yield git.setRemoteUrl(sshUrl);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
// Checkout
|
// Checkout
|
||||||
|
core.startGroup('Checking out the ref');
|
||||||
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
|
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
|
||||||
|
core.endGroup();
|
||||||
// Submodules
|
// Submodules
|
||||||
if (settings.submodules) {
|
if (settings.submodules) {
|
||||||
try {
|
try {
|
||||||
|
@ -7290,7 +7300,9 @@ function prepareExistingDirectory(git, repositoryPath, preferredRemoteUrl, allow
|
||||||
}
|
}
|
||||||
// Update to the preferred remote URL
|
// Update to the preferred remote URL
|
||||||
if (remoteUrl !== preferredRemoteUrl) {
|
if (remoteUrl !== preferredRemoteUrl) {
|
||||||
|
core.startGroup('Setting the remote URL');
|
||||||
yield git.setRemoteUrl(preferredRemoteUrl);
|
yield git.setRemoteUrl(preferredRemoteUrl);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
|
@ -94,7 +94,9 @@ export async function prepareExistingDirectory(
|
||||||
|
|
||||||
// Update to the preferred remote URL
|
// Update to the preferred remote URL
|
||||||
if (remoteUrl !== preferredRemoteUrl) {
|
if (remoteUrl !== preferredRemoteUrl) {
|
||||||
|
core.startGroup('Setting the remote URL')
|
||||||
await git.setRemoteUrl(preferredRemoteUrl)
|
await git.setRemoteUrl(preferredRemoteUrl)
|
||||||
|
core.endGroup()
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.warning(
|
core.warning(
|
||||||
|
|
|
@ -92,16 +92,20 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
if (
|
if (
|
||||||
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
|
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
|
||||||
) {
|
) {
|
||||||
|
core.startGroup('Initializing the repository')
|
||||||
await git.init()
|
await git.init()
|
||||||
await git.remoteAdd('origin', initialRemoteUrl)
|
await git.remoteAdd('origin', initialRemoteUrl)
|
||||||
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable automatic garbage collection
|
// Disable automatic garbage collection
|
||||||
|
core.startGroup('Disabling automatic garbage collection')
|
||||||
if (!(await git.tryDisableAutomaticGarbageCollection())) {
|
if (!(await git.tryDisableAutomaticGarbageCollection())) {
|
||||||
core.warning(
|
core.warning(
|
||||||
`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`
|
`Unable to turn off git automatic garbage collection. The git fetch operation may trigger garbage collection and cause a delay.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||||
try {
|
try {
|
||||||
|
@ -122,11 +126,13 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Checkout info
|
// Checkout info
|
||||||
|
core.startGroup('Determining the checkout info')
|
||||||
const checkoutInfo = await refHelper.getCheckoutInfo(
|
const checkoutInfo = await refHelper.getCheckoutInfo(
|
||||||
git,
|
git,
|
||||||
settings.ref,
|
settings.ref,
|
||||||
settings.commit
|
settings.commit
|
||||||
)
|
)
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
// LFS fetch
|
// LFS fetch
|
||||||
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
||||||
|
@ -139,11 +145,15 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
|
|
||||||
// Fix URL when using SSH
|
// Fix URL when using SSH
|
||||||
if (settings.sshKey && initialRemoteUrl !== sshUrl) {
|
if (settings.sshKey && initialRemoteUrl !== sshUrl) {
|
||||||
|
core.startGroup('Updating the repository to use the SSH URL')
|
||||||
await git.setRemoteUrl(sshUrl)
|
await git.setRemoteUrl(sshUrl)
|
||||||
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checkout
|
// Checkout
|
||||||
|
core.startGroup('Checking out the ref')
|
||||||
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint)
|
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint)
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
// Submodules
|
// Submodules
|
||||||
if (settings.submodules) {
|
if (settings.submodules) {
|
||||||
|
|
Loading…
Reference in a new issue