From 1cdd94cb46ca9603979d2bf59b7e0a205ce295cc Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 14 Jun 2017 02:02:14 -0400 Subject: [PATCH] Adds a with method to commit --- src/git/models/commit.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/git/models/commit.ts b/src/git/models/commit.ts index cadf1a6..cbd106b 100644 --- a/src/git/models/commit.ts +++ b/src/git/models/commit.ts @@ -76,4 +76,12 @@ export class GitCommit { getFormattedPath(separator: string = Strings.pad(GlyphChars.Dot, 2, 2)): string { return GitUri.getFormattedPath(this.fileName, separator); } + + with(changes: { type?: GitCommitType, fileName?: string, sha?: string, originalFileName?: string, previousFileName?: string, previousSha?: string }) { + return new GitCommit(changes.type || this.type, this.repoPath, + changes.sha || this.sha, changes.fileName || this.fileName, + this.author, this.date, this.message, + changes.originalFileName || this.originalFileName, + changes.previousSha || this.previousSha, changes.previousFileName || this.previousFileName); + } } \ No newline at end of file