Set commits analysis case-insenstive #338
This commit is contained in:
@@ -72,11 +72,12 @@ export async function recent({login, data, imports, rest, account}, {skipped, da
|
||||
|
||||
//Retrieve edited files and filter edited lines (those starting with +/-) from patches
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > loading patches`)
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > commits authoring set to ${JSON.stringify(data.shared["commits.authoring"])}`)
|
||||
const patches = [
|
||||
...await Promise.allSettled(
|
||||
commits
|
||||
.flatMap(({payload}) => payload.commits)
|
||||
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.includes(authoring)||author?.name?.includes(authoring)).length)
|
||||
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length)
|
||||
.map(commit => commit.url)
|
||||
.map(async commit => (await rest.request(commit)).data.files),
|
||||
),
|
||||
@@ -101,7 +102,7 @@ export async function recent({login, data, imports, rest, account}, {skipped, da
|
||||
//Create temporary git repository
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > creating temp git repository`)
|
||||
const git = await imports.git(path)
|
||||
await git.init().add(".").addConfig("user.name", login).addConfig("user.email", "<>").commit("linguist").status()
|
||||
await git.init().add(".").addConfig("user.name", data.shared["commits.authoring"]?.[0] ?? login).addConfig("user.email", "<>").commit("linguist").status()
|
||||
|
||||
//Analyze repository
|
||||
await analyze(arguments[0], {results, path})
|
||||
@@ -128,7 +129,7 @@ async function analyze({login, imports, data}, {results, path}) {
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > indepth > checking git log`)
|
||||
for (let page = 0; ; page++) {
|
||||
try {
|
||||
const stdout = await imports.run(`git log ${data.shared["commits.authoring"].map(authoring => `--author="${authoring}"`).join(" ")} --format="" --patch --max-count=${per_page} --skip=${page*per_page}`, {cwd:path}, {log:false})
|
||||
const stdout = await imports.run(`git log ${data.shared["commits.authoring"].map(authoring => `--author="${authoring}"`).join(" ")} --regexp-ignore-case --format="" --patch --max-count=${per_page} --skip=${page*per_page}`, {cwd:path}, {log:false})
|
||||
let file = null, lang = null
|
||||
if (!stdout.trim().length) {
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > indepth > no more commits`)
|
||||
|
||||
Reference in New Issue
Block a user