mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:04:14 +08:00
Git - remove another usage of iconv (#243902)
This commit is contained in:
parent
6191768413
commit
46a9b7e644
@ -10,7 +10,6 @@ import * as cp from 'child_process';
|
||||
import { fileURLToPath } from 'url';
|
||||
import which from 'which';
|
||||
import { EventEmitter } from 'events';
|
||||
import * as iconv from '@vscode/iconv-lite-umd';
|
||||
import * as filetype from 'file-type';
|
||||
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter, Versions, isWindows, pathEquals, isMacintosh, isDescendant, relativePath } from './util';
|
||||
import { CancellationError, CancellationToken, ConfigurationChangeEvent, LogOutputChannel, Progress, Uri, workspace } from 'vscode';
|
||||
@ -1739,10 +1738,10 @@ export class Repository {
|
||||
await this.exec(args);
|
||||
}
|
||||
|
||||
async stage(path: string, data: string, encoding: string): Promise<void> {
|
||||
async stage(path: string, data: Uint8Array): Promise<void> {
|
||||
const relativePath = sanitizeRelativePath(this.repositoryRoot, path);
|
||||
const child = this.stream(['hash-object', '--stdin', '-w', '--path', relativePath], { stdio: [null, null, null] });
|
||||
child.stdin!.end(iconv.encode(data, encoding));
|
||||
child.stdin!.end(data);
|
||||
|
||||
const { exitCode, stdout } = await exec(child);
|
||||
const hash = stdout.toString('utf8');
|
||||
|
||||
@ -1222,7 +1222,8 @@ export class Repository implements Disposable {
|
||||
|
||||
async stage(resource: Uri, contents: string, encoding: string): Promise<void> {
|
||||
await this.run(Operation.Stage, async () => {
|
||||
await this.repository.stage(resource.fsPath, contents, encoding);
|
||||
const data = await workspace.encode(contents, resource, { encoding });
|
||||
await this.repository.stage(resource.fsPath, data);
|
||||
|
||||
this._onDidChangeOriginalResource.fire(resource);
|
||||
this.closeDiffEditors([], [...resource.fsPath]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user