提交 b7ba7b58 编写于 作者: B Benjamin Pasero

simplify

上级 af91521c
......@@ -33,7 +33,7 @@ export function encodeStream(encoding: string): NodeJS.ReadWriteStream {
return iconv.encodeStream(toNodeEncoding(encoding));
}
export function toNodeEncoding(enc: string): string {
function toNodeEncoding(enc: string): string {
if (enc === UTF8_with_bom) {
return UTF8; // iconv does not distinguish UTF 8 with or without BOM, so we need to help it
}
......
......@@ -15,7 +15,7 @@ import { IRawFileStatus, IHead, ITag, IBranch, IRemote, GitErrorCodes, IPushOpti
import { detectMimesFromStream } from 'vs/base/node/mime';
import files = require('vs/platform/files/common/files');
import { spawn, ChildProcess } from 'child_process';
import { decode, encodingExists, toNodeEncoding } from 'vs/base/node/encoding';
import { decode, encodingExists } from 'vs/base/node/encoding';
export interface IExecutionResult {
exitCode: number;
......@@ -339,7 +339,7 @@ export class Repository {
private doBuffer(object: string): TPromise<string> {
const child = this.show(object);
return exec(child, toNodeEncoding(this.defaultEncoding)).then(({ exitCode, stdout }) => {
return exec(child, this.defaultEncoding).then(({ exitCode, stdout }) => {
if (exitCode) {
return TPromise.wrapError<string>(new GitError({
message: 'Could not buffer object.',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册