Skip to content

Commit 2dd5abd

Browse files
committed
Fixed warning for configuration "files.encoding"
1 parent 42d7d42 commit 2dd5abd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/svn.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ export class Svn {
9595
args.push("--password", options.password);
9696
}
9797

98+
let encoding = options.encoding || "utf8";
99+
delete options.encoding;
100+
98101
const process = cp.spawn(this.svnPath, args, options);
99102

100103
const disposables: IDisposable[] = [];
@@ -138,10 +141,6 @@ export class Svn {
138141

139142
dispose(disposables);
140143

141-
let encoding = workspace
142-
.getConfiguration("files")
143-
.get<string>("encoding", "utf8");
144-
145144
// SVN with '--xml' always return 'UTF-8', and jschardet detects this encoding: 'TIS-620'
146145
if (args.includes("--xml")) {
147146
encoding = "utf8";

src/svnRepository.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from "fs";
22
import * as path from "path";
3+
import { Uri, workspace } from "vscode";
34
import {
45
ICpOptions,
56
IExecutionResult,
@@ -130,6 +131,7 @@ export class Repository {
130131
revision?: string,
131132
options: ICpOptions = {}
132133
): Promise<string> {
134+
const uri = Uri.file(file);
133135
file = this.removeAbsolutePath(file);
134136
const args = ["cat"];
135137

@@ -147,7 +149,11 @@ export class Repository {
147149
args.push(file);
148150
}
149151

150-
const result = await this.exec(args);
152+
const encoding = workspace
153+
.getConfiguration("files", uri)
154+
.get<string>("encoding", "utf8");
155+
156+
const result = await this.exec(args, { encoding });
151157

152158
return result.stdout;
153159
}

0 commit comments

Comments
 (0)