Moves type to GitCommit for better consistency

This commit is contained in:
Eric Amodio
2017-03-28 15:10:00 -04:00
parent 073353dcda
commit aa39792843
9 changed files with 18 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ export interface IGitAuthor {
}
export interface IGitCommit {
type: GitCommitType;
repoPath: string;
sha: string;
fileName: string;
@@ -33,8 +34,11 @@ export interface IGitCommitLine {
code?: string;
}
export type GitCommitType = 'blame' | 'file' | 'repo';
export class GitCommit implements IGitCommit {
type: GitCommitType;
lines: IGitCommitLine[];
originalFileName?: string;
previousSha?: string;
@@ -43,6 +47,7 @@ export class GitCommit implements IGitCommit {
private _isUncommitted: boolean | undefined;
constructor(
type: GitCommitType,
public repoPath: string,
public sha: string,
public fileName: string,
@@ -54,6 +59,7 @@ export class GitCommit implements IGitCommit {
previousSha?: string,
previousFileName?: string
) {
this.type = type;
this.fileName = this.fileName && this.fileName.replace(/, ?$/, '');
this.lines = lines || [];

View File

@@ -1,11 +1,9 @@
'use strict';
import { Uri } from 'vscode';
import { GitCommit, IGitCommitLine } from './commit';
import { GitCommit, GitCommitType, IGitCommitLine } from './commit';
import { IGitStatusFile, GitStatusFileStatus } from './status';
import * as path from 'path';
export type GitLogType = 'file' | 'repo';
export class GitLogCommit extends GitCommit {
fileNames: string;
@@ -15,7 +13,7 @@ export class GitLogCommit extends GitCommit {
parentShas: string[];
constructor(
public type: GitLogType,
type: GitCommitType,
repoPath: string,
sha: string,
fileName: string,
@@ -29,7 +27,7 @@ export class GitLogCommit extends GitCommit {
previousSha?: string,
previousFileName?: string
) {
super(repoPath, sha, fileName, author, date, message, lines, originalFileName, previousSha, previousFileName);
super(type, repoPath, sha, fileName, author, date, message, lines, originalFileName, previousSha, previousFileName);
this.fileNames = this.fileName;