Skip to content

Commit

Permalink
[git] Fixed duplicated entries for git history on merge operations
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Bozzini <federico.bozzini@arm.com>
  • Loading branch information
federicobozzini committed Feb 20, 2020
1 parent 2ef80c0 commit 04c9fd2
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions packages/git/src/node/dugite-git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,23 @@ export class CommitDetailsParser extends OutputParser<CommitWithChanges> {
for (const chunk of chunks) {
const [sha, email, name, timestamp, authorDateRelative, summary, body, rawChanges] = chunk.trim().split(CommitDetailsParser.ENTRY_DELIMITER);
const fileChanges = this.nameStatusParser.parse(repositoryUri, (rawChanges || '').trim());
changes.push({
sha,
author: { timestamp, email, name },
authorDateRelative,
summary,
body,
fileChanges
});
const shaChange = changes.find(c => c.sha === sha);
if (shaChange !== undefined) {
for (const fileChange of fileChanges) {
if (!shaChange.fileChanges.some(c => c.uri === fileChange.uri)) {
shaChange.fileChanges.push(fileChange);
}
}
} else {
changes.push({
sha,
author: { timestamp, email, name },
authorDateRelative,
summary,
body,
fileChanges
});
}
}
return changes;
}
Expand Down

0 comments on commit 04c9fd2

Please sign in to comment.