fix(git-submodules): sequential submodules processing (#11659) (#11661)

This commit is contained in:
Eric Citaire 2021-09-09 17:34:09 +02:00 committed by GitHub
parent 955942b563
commit f4ebbb78a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,40 +98,33 @@ export default async function extractPackageFile(
return null; return null;
} }
const deps = ( const deps = [];
await Promise.all( for (const { name, path } of depNames) {
depNames.map(async ({ name, path }) => { try {
try { const [currentDigest] = (await git.subModule(['status', path]))
const [currentDigest] = (await git.subModule(['status', path])) .trim()
.trim() .replace(/^[-+]/, '')
.replace(/^[-+]/, '') .split(/\s/);
.split(/\s/); const subModuleUrl = await getUrl(git, gitModulesPath, name);
const subModuleUrl = await getUrl(git, gitModulesPath, name); // hostRules only understands HTTP URLs
// hostRules only understands HTTP URLs // Find HTTP URL, then apply token
// Find HTTP URL, then apply token let httpSubModuleUrl = getHttpUrl(subModuleUrl);
let httpSubModuleUrl = getHttpUrl(subModuleUrl); httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl);
httpSubModuleUrl = getRemoteUrlWithToken(httpSubModuleUrl); const currentValue = await getBranch(
const currentValue = await getBranch( gitModulesPath,
gitModulesPath, name,
name, httpSubModuleUrl
httpSubModuleUrl );
); deps.push({
return { depName: path,
depName: path, lookupName: getHttpUrl(subModuleUrl),
lookupName: getHttpUrl(subModuleUrl), currentValue,
currentValue, currentDigest,
currentDigest, });
}; } catch (err) /* istanbul ignore next */ {
} catch (err) /* istanbul ignore next */ { logger.warn({ err }, 'Error mapping git submodules during extraction');
logger.warn( }
{ err }, }
'Error mapping git submodules during extraction'
);
return null;
}
})
)
).filter(Boolean);
return { deps, datasource: datasourceGitRefs.id }; return { deps, datasource: datasourceGitRefs.id };
} }