Skip to content

Commit

Permalink
Fixes type mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 15, 2019
1 parent d60fdfd commit 06b23a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface Config {
};
toggleMode: AnnotationsToggleMode;
};
remotes: RemotesConfig[];
remotes: RemotesConfig[] | null;
showWhatsNewAfterUpgrades: boolean;
sortBranchesBy: BranchSorting;
sortTagsBy: TagSorting;
Expand Down Expand Up @@ -255,7 +255,7 @@ export interface AdvancedConfig {
closeOnFocusOut: boolean;
};
repositorySearchDepth: number;
similarityThreshold: number;
similarityThreshold: number | null;
telemetry: {
enabled: boolean;
};
Expand Down
26 changes: 16 additions & 10 deletions src/git/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export namespace Git {
fileName: string,
ref1?: string,
ref2?: string,
options: { encoding?: string; filter?: string; similarityThreshold?: number } = {}
options: { encoding?: string; filter?: string; similarityThreshold?: number | null } = {}
): Promise<string> {
const params = [
'diff',
Expand Down Expand Up @@ -605,7 +605,7 @@ export namespace Git {
repoPath: string,
ref1?: string,
ref2?: string,
{ filter, similarityThreshold }: { filter?: string; similarityThreshold?: number } = {}
{ filter, similarityThreshold }: { filter?: string; similarityThreshold?: number | null } = {}
) {
const params = [
'diff',
Expand Down Expand Up @@ -697,7 +697,13 @@ export namespace Git {
merges,
reverse,
similarityThreshold
}: { authors?: string[]; limit?: number; merges?: boolean; reverse?: boolean; similarityThreshold?: number }
}: {
authors?: string[];
limit?: number;
merges?: boolean;
reverse?: boolean;
similarityThreshold?: number | null;
}
) {
const params = [
'log',
Expand Down Expand Up @@ -806,7 +812,7 @@ export namespace Git {
export async function log__file_recent(
repoPath: string,
fileName: string,
{ ref, similarityThreshold }: { ref?: string; similarityThreshold?: number } = {}
{ ref, similarityThreshold }: { ref?: string; similarityThreshold?: number | null } = {}
) {
const params = [
'log',
Expand Down Expand Up @@ -1068,7 +1074,7 @@ export namespace Git {
fileName: string,
ref: string,
originalFileName?: string,
{ similarityThreshold }: { similarityThreshold?: number } = {}
{ similarityThreshold }: { similarityThreshold?: number | null } = {}
) {
const params = [
'show',
Expand Down Expand Up @@ -1110,7 +1116,7 @@ export namespace Git {
{
format = GitStashParser.defaultFormat,
similarityThreshold
}: { format?: string; similarityThreshold?: number } = {}
}: { format?: string; similarityThreshold?: number | null } = {}
) {
return git<string>(
{ cwd: repoPath },
Expand Down Expand Up @@ -1156,7 +1162,7 @@ export namespace Git {
export function status(
repoPath: string,
porcelainVersion: number = 1,
{ similarityThreshold }: { similarityThreshold?: number } = {}
{ similarityThreshold }: { similarityThreshold?: number | null } = {}
): Promise<string> {
const params = [
'status',
Expand All @@ -1165,7 +1171,7 @@ export namespace Git {
'-u'
];
if (Git.validateVersion(2, 18)) {
params.push(`--find-renames=${similarityThreshold == null ? '' : `${similarityThreshold}%`}`);
params.push(`--find-renames${similarityThreshold == null ? '' : `=${similarityThreshold}%`}`);
}

return git<string>(
Expand All @@ -1179,13 +1185,13 @@ export namespace Git {
repoPath: string,
fileName: string,
porcelainVersion: number = 1,
{ similarityThreshold }: { similarityThreshold?: number } = {}
{ similarityThreshold }: { similarityThreshold?: number | null } = {}
): Promise<string> {
const [file, root] = Git.splitPath(fileName, repoPath);

const params = ['status', porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain'];
if (Git.validateVersion(2, 18)) {
params.push(`--find-renames=${similarityThreshold == null ? '' : `${similarityThreshold}%`}`);
params.push(`--find-renames${similarityThreshold == null ? '' : `=${similarityThreshold}%`}`);
}

return git<string>(
Expand Down

0 comments on commit 06b23a0

Please sign in to comment.