Navigation Menu

Skip to content

Commit

Permalink
fix(git-submodules): sequential submodules processing (#11659) (#11661)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcitaire committed Sep 9, 2021
1 parent 955942b commit f4ebbb7
Showing 1 changed file with 27 additions and 34 deletions.
61 changes: 27 additions & 34 deletions lib/manager/git-submodules/extract.ts
Expand Up @@ -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 };
}

0 comments on commit f4ebbb7

Please sign in to comment.