mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
This commit is contained in:
parent
955942b563
commit
f4ebbb78a9
1 changed files with 27 additions and 34 deletions
|
@ -98,40 +98,33 @@ export default async function extractPackageFile(
|
|||
return null;
|
||||
}
|
||||
|
||||
const deps = (
|
||||
await Promise.all(
|
||||
depNames.map(async ({ name, path }) => {
|
||||
try {
|
||||
const [currentDigest] = (await git.subModule(['status', path]))
|
||||
.trim()
|
||||
.replace(/^[-+]/, '')
|
||||
.split(/\s/);
|
||||
const subModuleUrl = await getUrl(git, gitModulesPath, name);
|
||||
// hostRules only understands HTTP URLs
|
||||
// Find HTTP URL, then apply token
|
||||
let httpSubModuleUrl = getHttpUrl(subModuleUrl);
|
||||
httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl);
|
||||
const currentValue = await getBranch(
|
||||
gitModulesPath,
|
||||
name,
|
||||
httpSubModuleUrl
|
||||
);
|
||||
return {
|
||||
depName: path,
|
||||
lookupName: getHttpUrl(subModuleUrl),
|
||||
currentValue,
|
||||
currentDigest,
|
||||
};
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.warn(
|
||||
{ err },
|
||||
'Error mapping git submodules during extraction'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
)
|
||||
).filter(Boolean);
|
||||
const deps = [];
|
||||
for (const { name, path } of depNames) {
|
||||
try {
|
||||
const [currentDigest] = (await git.subModule(['status', path]))
|
||||
.trim()
|
||||
.replace(/^[-+]/, '')
|
||||
.split(/\s/);
|
||||
const subModuleUrl = await getUrl(git, gitModulesPath, name);
|
||||
// hostRules only understands HTTP URLs
|
||||
// Find HTTP URL, then apply token
|
||||
let httpSubModuleUrl = getHttpUrl(subModuleUrl);
|
||||
httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl);
|
||||
const currentValue = await getBranch(
|
||||
gitModulesPath,
|
||||
name,
|
||||
httpSubModuleUrl
|
||||
);
|
||||
deps.push({
|
||||
depName: path,
|
||||
lookupName: getHttpUrl(subModuleUrl),
|
||||
currentValue,
|
||||
currentDigest,
|
||||
});
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.warn({ err }, 'Error mapping git submodules during extraction');
|
||||
}
|
||||
}
|
||||
|
||||
return { deps, datasource: datasourceGitRefs.id };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue