Unset the lfs.url if one isn't specified

This commit is contained in:
Matthew Endsley 2022-10-28 21:15:48 -07:00
parent f72e8cbe70
commit c5ef344f79
2 changed files with 37 additions and 18 deletions

11
dist/index.js vendored
View file

@ -31942,7 +31942,8 @@ function getSource(settings) {
const checkoutInfo = yield refHelper.getCheckoutInfo(git, settings.ref, settings.commit); const checkoutInfo = yield refHelper.getCheckoutInfo(git, settings.ref, settings.commit);
core.endGroup(); core.endGroup();
// LFS URL // LFS URL
if (settings.lfs && settings.lfsurl) { if (settings.lfs) {
if (settings.lfsurl) {
core.startGroup('Setting LFS URL'); core.startGroup('Setting LFS URL');
let remote = new url_1.URL(settings.lfsurl); let remote = new url_1.URL(settings.lfsurl);
remote.password = core.getInput('token'); remote.password = core.getInput('token');
@ -31964,6 +31965,14 @@ function getSource(settings) {
core.endGroup(); core.endGroup();
} }
} }
else {
yield git
.tryConfigUnset('lfs.url', false)
.catch(error => {
core.info(`Failed to remove lfs.url with error: ${error}`);
});
}
}
// 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.

View file

@ -197,7 +197,8 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
core.endGroup() core.endGroup()
// LFS URL // LFS URL
if (settings.lfs && settings.lfsurl) { if (settings.lfs) {
if (settings.lfsurl) {
core.startGroup('Setting LFS URL') core.startGroup('Setting LFS URL')
let remote = new URL(settings.lfsurl) let remote = new URL(settings.lfsurl)
remote.password = core.getInput('token') remote.password = core.getInput('token')
@ -223,6 +224,15 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
}) })
core.endGroup() core.endGroup()
} }
} else {
await git
.tryConfigUnset('lfs.url', false)
.catch(error => {
core.info(
`Failed to remove lfs.url with error: ${error}`
)
})
}
} }
// LFS fetch // LFS fetch