|
|
@ -1391,23 +1391,31 @@ export class GitService implements Disposable { |
|
|
|
async getContributors(repoPath: string): Promise<GitContributor[]> { |
|
|
|
if (repoPath == null) return []; |
|
|
|
|
|
|
|
const data = await Git.shortlog(repoPath); |
|
|
|
const shortlog = GitShortLogParser.parse(data, repoPath); |
|
|
|
if (shortlog == null) return []; |
|
|
|
|
|
|
|
// Mark the current user
|
|
|
|
const currentUser = await Container.git.getCurrentUser(repoPath); |
|
|
|
if (currentUser != null) { |
|
|
|
const index = shortlog.contributors.findIndex( |
|
|
|
c => currentUser.email === c.email && currentUser.name === c.name, |
|
|
|
); |
|
|
|
if (index !== -1) { |
|
|
|
const c = shortlog.contributors[index]; |
|
|
|
shortlog.contributors.splice(index, 1, new GitContributor(c.repoPath, c.name, c.email, c.count, true)); |
|
|
|
try { |
|
|
|
const data = await Git.shortlog(repoPath); |
|
|
|
const shortlog = GitShortLogParser.parse(data, repoPath); |
|
|
|
if (shortlog == null) return []; |
|
|
|
|
|
|
|
// Mark the current user
|
|
|
|
const currentUser = await Container.git.getCurrentUser(repoPath); |
|
|
|
if (currentUser != null) { |
|
|
|
const index = shortlog.contributors.findIndex( |
|
|
|
c => currentUser.email === c.email && currentUser.name === c.name, |
|
|
|
); |
|
|
|
if (index !== -1) { |
|
|
|
const c = shortlog.contributors[index]; |
|
|
|
shortlog.contributors.splice( |
|
|
|
index, |
|
|
|
1, |
|
|
|
new GitContributor(c.repoPath, c.name, c.email, c.count, true), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return shortlog.contributors; |
|
|
|
return shortlog.contributors; |
|
|
|
} catch (ex) { |
|
|
|
return []; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@log() |
|
|
|